|
-
October 28th, 2009, 01:09 PM
#1
[RESOLVED] Trap right-click + control using masks
How to trap right-click + control using masks? I tried but it doesn't work. If I replace BUTTON3_DOWN_MASK to BUTTON1_DOWN_MASK or BUTTON2_DOWN_MASK, it works. Why? I don't understand. @.@
Thank you.
Code:
public class FrameTest extends JFrame {
public FrameTest()
{
setSize(500, 500);
setLocation(300, 200);
setVisible(true);
setFocusable(true);
addMouseListener(new MouseAdapter()
{
public void mousePressed(MouseEvent e) {
int mask = MouseEvent.CTRL_DOWN_MASK | MouseEvent.BUTTON3_DOWN_MASK;
if((e.getModifiersEx() & mask) == mask)
{
JOptionPane.showMessageDialog(null, "Ku");
}
}
});
}
public static void main(String[] args) {
FrameTest app = new FrameTest();
app.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}
-
October 28th, 2009, 03:16 PM
#2
Re: Trap right-click + control using masks
sorry, wrong-place post
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|