popup menu
I want to have a popup menu and a menu in the menubar to contain the same menu items. click on either one should launch the event.
is this valid
JMenuBar mymenubar=new JMenuBar();
JMenu mymenu=new JMenu("Tools");
JMenuItem item1=new JMenuItem("Cut");
JMenuItem item2=new JMenuItem("Copy");
JMenuItem item3=new JMenuItem("Paste");
mymenu.add(item1);
mymenu.add(item2);
mymenu.add(item3);
mymenubar.add(mymenu);
//add event handlers to these
//now, set up the JPopupMenu
JPopupMenu mypopupmenu=new JPopupMenu();
mypopupmenu.add(item1);
mypopupmenu.add(item2);
mypopupmenu.add(item3);
is this allowed or will the compiler complain?

