wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Adding Submenu to JMenuItem. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Adding Submenu to JMenuItem. " Watch "Adding Submenu to JMenuItem. " New topic
Author

Adding Submenu to JMenuItem.

Rush Art
Greenhorn

Joined: Oct 17, 2009
Posts: 7
Hello, I having trouble finding out how to attached submenu to the JMenuItem "Global" with text such as "Max,Min,Sum" as shown on the taken picture. Any idea how the code is for this one?

Thanks.






[Thumbnail for Submenu.JPG]

Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19723
    
  20

Global shouldn't be a JMenuItem but a JMenu instead. That one has methods to add more JMenuItems. And remember, JMenu extends JMenuItem.

Moving to Swing.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10486
    
    9

Recommended reading: http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Rush Art
Greenhorn

Joined: Oct 17, 2009
Posts: 7
Thanks a lot I manged to get this working.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Adding Submenu to JMenuItem.