File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Event not working for JMenuItem

 
Prince khurana
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 47232
52
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2475
8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
when I click on menuitem2 "about" nothing appears ??


I don't see a frame.setVisible() anywhere.
 
Prince khurana
Greenhorn
Posts: 6
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 !
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic