aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes How Can I Disable Menu-Items? 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 "How Can I Disable Menu-Items?" Watch "How Can I Disable Menu-Items?" New topic
Author

How Can I Disable Menu-Items?

Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

I have the following code to implement an edit menu. For now, I want to be able to control which menu-items are enabled or disabled by implementing the method: menuSelected(MenuEvent).

I thought that I had this working, but now, all of the menu-items are always enabled. (I've tried this with and without implementing an ActionListener interface.




Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
add this to the end of the constructor

addMenuListener(this);
Kaydell Leavitt
Ranch Hand

Joined: Nov 18, 2006
Posts: 689

Thank you very much Michael.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: How Can I Disable Menu-Items?