[NetBeans]changing menuitems
- From: Daniel Moyne <daniel.moyne@xxxxxxx>
- Date: Fri, 25 Jul 2008 18:03:32 +0200
I am using Netbeans and in my class "GenListView" where most of the code is
created by Netbeans I have menu items members with private status which
means that oustide of any instances of "GenListView" NO WAY to simply
change any of those menu items like desabling enabling them.
As I want to do this from a class that I will call hereafter "Other" not
included in GenListView this is what I did :
(a) in class "GenListView" I added this :
- in some methods :
menuItem1=jMenuItem1; //jMenuItem is declared as private by NetBeans
instance = this;
- these 2 methods :
public static GenListView getInstance() {
return instance;
}
public void enableMenuItem(JMenuItem menuItem) {
menuItem.setEnabled(true);
}
- these members :
static public GenListView instance;
public JMenuItem menuItem1;
(b) in class "Other" I added this :
- in some method :
GenListView.getInstance().disableMenuItem(GenListView.getInstance().menuItem1);
It works but looks complex to me ; any way to make it simpler as there is no
possibility for direct access of "jMenuItem1" from other class ?
Regards.
.
- Follow-Ups:
- Re: [NetBeans]changing menuitems
- From: Mark Space
- Re: [NetBeans]changing menuitems
- From: RedGrittyBrick
- Re: [NetBeans]changing menuitems
- Prev by Date: Re: Javadoc @see
- Next by Date: Re: [NetBeans]changing menuitems
- Previous by thread: Webapplications and ACL's. Best practice
- Next by thread: Re: [NetBeans]changing menuitems
- Index(es):
Relevant Pages
|