aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JMenuItems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JMenuItems" Watch "JMenuItems" New topic
Author

JMenuItems

Chase Bond
Greenhorn

Joined: May 20, 2009
Posts: 3
I am trying to write a GUI that has a menu, with JMenuItems, and JMenuItems inside JMenuItems. But every time I try to add JMenuItems to JMenuItems they overwrite the name of the previous JMenuItem. How can I fix this problem?
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19720
    
  20

Use JMenus as JMenuItem containers. JMenu extends JMenuItem so you can use a JMenu everywhere you can use a JMenuItem.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
Chase Bond
Greenhorn

Joined: May 20, 2009
Posts: 3
Thanks. I am new at this so can you show me how I could use it as a container?
Chase Bond
Greenhorn

Joined: May 20, 2009
Posts: 3
Never Mind my last comment I just figured it out. Thanks anyways!
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632

http://java.sun.com/docs/books/tutorial/uiswing/components/menu.html
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: JMenuItems