• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Event not working for JMenuItem

 
Prince khurana
Greenhorn
Posts: 6
  • 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
Posts: 48386
56
  • 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: 2539
9
  • 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
  • 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 !
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic