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 enabling & disabling menuitems Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Reply locked New topic

enabling & disabling menuitems

pankaj saxena
Ranch Hand

Joined: Nov 21, 2009
Posts: 46

I have already used setEnabled() method , but the case is , it is disabling all menuitems but when i call setEnabled(true) then it is not enabling the menuitems.

Moreover, my class hierarchy is like as follows:

1. : it is a frame that contains two Panels , one panel contains Menubar while second panel is emtpy which i am using to display each page( a panel to take user input) by clicking on menuitem(eg. PersonalDetails).

2. I am declaring , initializing all menuitems in and on its menuitem click event i call "" and there itself , i disable other menuitems. So far, its working as per me. But, on the display of PersonalDetails class, which contains a GUI form and a "Close "button . On "Close " button event handling i have called setEditable(true) on each menuitem.

It is throwing NullPointerException , since the PersonalDetails class doesn't have anything related to Menuitems, so i want to ask how should i move forward. Do i need to write one Utility class or something else.

Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3152

Can you show us the code please? - The code which is related to the issue you have mentioned.

Mohamed Sanaulla | My Blog
Rob Spoor

Joined: Oct 27, 2005
Posts: 20271

Once is enough. Please UseOneThreadPerQuestion. I'll close this thread; please use your old thread for this problem.

But I do suggest you follow Mohamed's suggestion - show us some code. In your other thread of course.

How To Ask Questions How To Answer Questions
I agree. Here's the link:
subject: enabling & disabling menuitems
It's not a secret anymore!