I'm having trouble making a JMenuItem
in one class pull up a JTree
from another class that would act as a Help
menu for a program I'm making. The main problem I'm having is calling the JTree
from the one class through an ActionListener
in the JMenuItem
's class.
Here's the code from the JMenuItem's class that I'm talking about:
/*pulls up help menu*/
JMenuItem item1 = new JMenuItem("Help Menu");
myMenu.add(item1);
item1.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent event){
**if(item1.isEnabled()){
sjt = new SampleJTree();
}**
}
});
As I stated before, I'm not sure how to bring a JTree via the bold section (i.e. I don't know what to put in the if statement check). Any direction to the solution would be much appreciated.