File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Menu Problems" Watch "Menu Problems" New topic

Menu Problems

Alan Frentz

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" ));
I agree. Here's the link:
subject: Menu Problems
It's not a secret anymore!