This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 688

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

Thank you very much Michael.
 
Don't get me started about those stupid light bulbs.
 
subject: How Can I Disable Menu-Items?
 
Similar Threads
Menu Problems
Sharing JMenuItems
Swing GUI Interface Question
Creating one class from another
GUI: Cut/Copy/Paste/Etc.