I have a jMenu bar and it is enabled by default. On selecting first item, I am disabling the jMenu
Here is code on first menu item. Basically ViewCustomerAccountsDetails
is a jInterframe :-
ViewCustomerAccountsDetails vca = new ViewCustomerAccountsDetails();
this.jDesktopPane1.add(vca);
vca.show();
jMenu1.setEnabled(false);
Now, in class ViewCustomerAccountsDetails
, I have a Button and on its click, i am hiding this JInternal frame and
trying to enable the jMenu bar :-
CustomerMainScreenLogin cmsl = new CustomerMainScreenLogin();
cmsl.jMenu1.setEnabled(true); //jMenu is public
this.dispose();
But it is not working. It is still disabled.
Here:
Why do you create a new instance of
CustomerMainScreenLogin
class? Most likelyjMenu1
is enabled but in a new non visibleCustomerMainScreenLogin
object. To make it visible just callcms1.setVisible(true)
and you'll see that.So you need to reference the current instance of
CustomerMainScreenLogin
class instead of creating a new one. For instance by makingjMenu1
static and callingjMenu1.setEnabled(true)
in this way: