aspose file tools *
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
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: 63

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: 63

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: 2227
    
    8
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: 63

Thanks.
Thank you very much.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Menu Items are not appearing.