Why does JMenuItem react to right button?  
Author Message
diegomrosa





PostPosted: 2006-6-10 4:19:00 Top

java-programmer, Why does JMenuItem react to right button? In all the applications that I know, menu items react only to mouse
left-click. Swing JMenuItem, however, reacts to any mouse button click.
Swing JButton (which also extends AbstractButton) behaves as expected.
Does anybody know why? Is there any way to change this behavior?

Thanks in advance,
Diego

 
Robert Iver





PostPosted: 2006-6-10 5:38:00 Top

java-programmer >> Why does JMenuItem react to right button? I'm sure that the behavior can be changed by modifying the event
listeners associated with the JMenuItem. Or, just have your program
check which mouse button was pressed, and then just ignore that
event....

There's always a way to get the computer to do what you want, as long
as you can somehow manage to tell it what you want. lol :-)

I'm sorry I can't be of more help, just learning Java myself.....maybe
a more senior programmer can give some code samples or something.


diegomrosa wrote:
> In all the applications that I know, menu items react only to mouse
> left-click. Swing JMenuItem, however, reacts to any mouse button click.
> Swing JButton (which also extends AbstractButton) behaves as expected.
> Does anybody know why? Is there any way to change this behavior?
>
> Thanks in advance,
> Diego