This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes Menu Items are not appearing. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Menu Items are not appearing." Watch "Menu Items are not appearing." New topic
Author

Menu Items are not appearing.

Moguluri Ravi Kiran
Ranch Hand

Joined: Apr 16, 2010
Posts: 62

Hello Friends , i got a small problem, below is the code. Thanks in advance.
My OS is windows 7.



[Thumbnail for frame.png]

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
a component can have only one parent,
so, add 'exit'/'sbar' to the menu or the toolbar, not both
Moguluri Ravi Kiran
Ranch Hand

Joined: Apr 16, 2010
Posts: 62

Thanks for your speedy response. i undestood.

but what if i want a common choice like "SAVE" on File Menu & Tool bar simultaneously..do i need to write extra object(toolbar item that represents same menu item). & do i need to write redundently the Listeners..?

Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
just add another button to the toolbar (also with e.g. "Exit"),
then set the button's model to that of the exitmenu's model
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2155
    
    7
Moguluri Ravi Kiran wrote:but what if i want a common choice like "SAVE" on File Menu & Tool bar simultaneously..do i need to write extra object(toolbar item that represents same menu item). & do i need to write redundently the Listeners..?


You need to create an Action that can be used by both components:



Read the section from the Swing tutorial on How to Use Actions for more information and examples.
Moguluri Ravi Kiran
Ranch Hand

Joined: Apr 16, 2010
Posts: 62

Thanks.
Thank you very much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Menu Items are not appearing.
 
Similar Threads
Making JTabbed Pane visible???
Can you help me to write better code ?
JMenuItem.setMargin
Exception Null
why this component access is multiplying?