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 Menu Problems 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 "Menu Problems" Watch "Menu Problems" New topic
Author

Menu Problems

Alan Frentz
Greenhorn

Joined: Mar 16, 2004
Posts: 1
Hi, I am working on a simple menu and running into a bit of difficulty. I have the menu created and it works well except for one issue, I cannot get the greying out of options to work. Specifically, when I select EDIT / OPTIONS / READ ONLY it should grey out the save/saveas options but instead I get a null pointer exception error. Your advice would be much appreciated. Thanks
Now for the code......
Carlos Failde
Ranch Hand

Joined: Oct 20, 2000
Posts: 84
I draw your attention to these lines of code.
private Action saveAction;
private Action saveAsAction;
....
// set up Save menu item
JMenuItem saveItem = fileMenu.add(new TestAction( "Save" ));
// set up Save As menu item
JMenuItem saveAsItem = fileMenu.add(new TestAction( "Save As" ));
...
saveAction.setEnabled(!readOnlyItem.isSelected());
saveAsAction.setEnabled(!readOnlyItem.isSelected());
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Menu Problems
 
Similar Threads
GUI: Cut/Copy/Paste/Etc.
Swing GUI Interface Question
Swing graphic problem
MenuBar & Listener Compile errors
Creating one class from another