tags:

views:

180

answers:

1

I was trying to create a mouse clicked event of a JmenuItem but it did not work but mouse pressed event works. what is the difference between clicked and pressed and why only pressed works here?

+1  A: 

Works fine for me. A mouseClicked is generated when a mousePressed and mouseReleased is received at the same pixel location. If you move the mouse even 1 pixel between the two events the mouseClicked is not generated.

That is why you should stick with the ActionListener which is the way a menu item was designed to be used.

camickr