| Author |
Rightclicking on components
|
Emil Karlsson
Ranch Hand
Joined: May 23, 2002
Posts: 63
|
|
Hi, I have made a class that extend a JButton, now I would like to show a popup when I make a rightclick over the component! The same procedure works perfect with JLabel! Why does it not work with JButton? /Emil Karlsson
|
 |
Chantal Ackermann
Ranch Hand
Joined: Sep 28, 2000
Posts: 508
|
|
some code of yours would be helpful. especially, where you catch the popup events for your JLabel and for your JButton. are you checking whether the mouse event is a popup trigger? (event.isPopupTrigger()) chantal
|
 |
Nathan Pruett
Bartender
Joined: Oct 18, 2000
Posts: 4121
|
|
I don't know how to do it with your extended button, since you didn't post the code... but here's how you can add a popup menu to a normal JButton... ( Chantal - for some weird reason isPopupTrigger() wouldn't work... I had to use isMetaDown()... )
|
-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
|
 |
Emil Karlsson
Ranch Hand
Joined: May 23, 2002
Posts: 63
|
|
Thanks a lot. Now it works as I want. /Emil
|
 |
 |
|
|
subject: Rightclicking on components
|
|
|