Hi,
I have a small project I am working on.
Right now it has two classes...one is the main class the other is a class that implements a JMenuBar. The main class creates an instance of the class implementing the JMenuBar. Some menu items are created dynamically based on the contents of a file. All this works fine.
What I want to do now is have something change on the main window (implemented by the main class) when the user clicks on a specific menu item.
Here is what I have so far:
The class that creates the menu:
public class WorkoutMenu implements ActionListener {
JMenuBar menuBar;
JMenu menu;
JMenuItem quitItem, viewItem;
ArrayList<
String> userArray = new ArrayList<String>();
WorkoutRoutines wr;
public JMenuBar WorkoutMenu() {
. . .
//create the ViewMenu dynamically
this.makeViewMenu(menuBar);
. . .
return menuBar;
}
The menubar gets made and the event handlers work:
public void actionPerformed(ActionEvent event) {
if (event.getActionCommand() == "Exit") {
System.exit(0);
}
if (event.getActionCommand() == "Mike") {
wr.testText = "Mike is here";
wr.update();
}
}
In the above code, I want the wr.testText to update the label on the main frame.
This does not work....how can I get this to work correctly?
Thanks,
Mike