aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Event not working for JMenuItem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Event not working for JMenuItem" Watch "Event not working for JMenuItem" New topic
Author

Event not working for JMenuItem

Prince khurana
Greenhorn

Joined: Mar 30, 2013
Posts: 6
Hey guys , need some GUI help.

There is an event code for both the menu items below in my prograom.

Here is my code :


When I click on menuitem1 "guide" the event works fine but when I click on menuitem2 "about" nothing appears ??

I don't think there is anything wrong with the code don't know why where am I doing wrong ? someone please help.
Thanks a ton in advance.








Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38765
    
  23
I would suggest you lose that listener class and create one class per effect expected. One for the guide item, one for exit, one for help.
There is something wrong with the code you quoted. You seem to start off the inner class, but it never seems to finish. Where is its closing }? There are very good reasons for indentation conventions, for writing code backwards, and for class naming. “thehandler” is a poor name for a listener class (it should end with Listener). You have four incorrectly aligned }s at the end of that class, which make reading the class very difficult.
Rob Camick
Ranch Hand

Joined: Jun 13, 2009
Posts: 2182
    
    7
when I click on menuitem2 "about" nothing appears ??


I don't see a frame.setVisible() anywhere.
Prince khurana
Greenhorn

Joined: Mar 30, 2013
Posts: 6
Rob Camick wrote:
when I click on menuitem2 "about" nothing appears ??


I don't see a frame.setVisible() anywhere.



Oh thanks a lot Sir, it worked !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Event not working for JMenuItem