Only 48 hours left in the trailboss' kickstarter!

New rewards and stretch goals. CLICK HERE!



  • Post Reply Bookmark Topic Watch Topic
  • New Topic

close a frame with menu item  RSS feed

 
mark smith
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi

on a jframe i have a jmenu bar with a jmenu and 2 jmenuitem,
i try to close my application...



in my jMenuItem2MouseClicked.....
i click on the item.... but this event never happen....
any idea?

thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
mouseClicked() does not fire if the mouse is moved during mousePressed and mouseReleased()
try changing to mousePressed(), see if it works

any reason you're not using an actionListener for this?
 
mark smith
Ranch Hand
Posts: 257
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Michael Dunn:
mouseClicked() does not fire if the mouse is moved during mousePressed and mouseReleased()
try changing to mousePressed(), see if it works

any reason you're not using an actionListener for this?


thanks work fine with mousePressed.....

don't know, i'm a newbies with java gui.... have you an example for that?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> have you an example for that?

this method name
jMenuItem2MouseClicked
is generated by netbeans(?), I don't know what the equivalent is for
actionListener - it's not important, just the argument 'type' needs changing
from MouseEvent to ActionEvent

 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!