This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Swing / AWT / SWT and the fly likes JMenubar/Jmenu/JMenuItem does not work Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JMenubar/Jmenu/JMenuItem does not work" Watch "JMenubar/Jmenu/JMenuItem does not work" New topic
Author

JMenubar/Jmenu/JMenuItem does not work

ishan dave
Ranch Hand

Joined: Apr 16, 2007
Posts: 39
Dear friends,

I am facing a problame in using jmenu in my swing application. I am using netbeans5.5 for developing the form now in this form i attach a menubar and in menu bar 3 menues file, new form and exit. now when some one click on the exit menu the application should be exited. if new form menu clicked then some stuff and if he clicks file then again i give two menu items new form and exit. but none of these works can any one please guide me.


regards,
ishan dave
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38025
    
  22
You haven't got any listeners associated with any menu items.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38025
    
  22
. . . and you seem to have two JMenuBars.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38025
    
  22
. . . Don't try adding an exit menu to the JMenuBar; add a JMenuItem of that name, or add the exit item to the "File" Menu.
Make sure it has its ActionListener set up. Don't add ActionListeners to JMenus, but JMenuItems.
 
jQuery in Action, 2nd edition
 
subject: JMenubar/Jmenu/JMenuItem does not work
 
Similar Threads
Confused about painting in JPanels
How can i display minimize and iconifiable button in JInternalFrame
returning String from ActionPerformed
Main JFrame doesn't always regain focus when modal dialog closes
Whatz the problem