A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Swing / AWT / SWT
Selecting A Menu Item
Joined: Jun 23, 2004
Jun 23, 2004 02:21:00
Have created a frame with a nice menu on it and hav added a popup menu as well.
Now how do I get my app to respond to someone clicking on a menu item? Am armed with my 'Teach Yourself
In 21 Days' bible but doesn't cover this.
Joined: Jun 16, 2004
Jun 23, 2004 07:05:00
for each menu item you have, do the following:
where you substitute 'menuItem' for the actual name of your menu item, then
public void actionPerformed(
//..code to do whatever
That should work for you
Happy Coding all!
Joined: Dec 10, 2001
Jun 23, 2004 12:24:00
Moving this to the Swing / JFC / AWT forum...
How To Ask Good Questions
JavaRanch FAQ Wiki
subject: Selecting A Menu Item
a JMenuItem question,the value is too long
Swing graphic problem
simple web browser in java
To set the F1 key as shortcut for menuitem Help
enable and disable a menu item in a menu bar
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014