Showing submenu's in JPopupMenu
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Philip_Deacon
Posted On:   Wednesday, April 18, 2001 01:17 PM

Is it possible to show submenu's in a JPopupMenu? If so, do you have a one-liner on how to do this?

Thanks
Phil

Re: Showing submenu's in JPopupMenu

Posted By:   wang_sheng  
Posted On:   Wednesday, April 18, 2001 11:09 PM

JPopupMenu pop =
new javax.swing.JPopupMenu();

JMenu menu = new JMenu();
JMenuItem menuitem = new JMenuItem("1");
menu.add(menuitem);
menuitem = new JMenuItem("2");
menu.add(menuitem);

pop.add(menu);

JMenu menu = new JMenu();
menuitem = new JMenuItem("3");
menu.add(menuitem);
menuitem = new JMenuItem("4");
menu.add(menuitem);
pop.add(menu);
About | Sitemap | Contact