hi...i'm trying to add an actionListener to a menuItem. i looked at the tutorial on "how to use menus" but i cant seem to execute the menuitem. here's my code...
public class Controller implements ActionListener
{
GUI gui;
public Controller(GUI g)
{
gui = g;
gui.menuItem.addActionListener(this);
}
public void actionPerformed(ActionEvent e)
{
gui.menuItem = (JMenuItem)(e.getSource());
if (gui.menuItem.getText().equals("New Database"))
System.out.println("Hello");
}
}
where the class GUI is where the menItems have been added to the menus. i'm just trying out for one menuItem first but i wont get the "hello" printed on the screen...can someone give me some assistance on this given that i havent used JMenuItems before...thx in advance...