been working with the Beginning Java 2 (1.3 edition.)
page 629 working with the SketchFrame java file..
i don't understand how to create event handlers for when someone clicks on the menu and clicks on exit.. where do i define the exit button so when someone clicks on it, it closes the program..
Here's some of my code:
Code:
quitProgramAction = new FileAction("Quit Program",KeyStroke.getKeyStroke('Q', Event.CTRL_MASK));
Code:
addMenuItem(fileMenu, quitProgramAction);
Code:
private JMenuItem addMenuItem(JMenu menu, Action action)
{
JMenuItem item = menu.add(action);
KeyStroke keystroke = (KeyStroke)action.getValue(action.ACCELERATOR_KEY);
if(keystroke != null)
item.setAccelerator(keystroke);
return item;
}
any help is greatly appreciated
thanks..
--
Eric Giblock