• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Menu Problems

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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......
 
Ranch Hand
Posts: 84
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 will open the floodgates of his own worst nightmare! All in a tiny ad:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic