Hi Michael,
You can use the following logic:
if ((event.getModifiers() & ActionEvent.CTRL_MASK) ==
ActionEvent.CTRL_MASK) {
System.out.println("CTRL KEY PRESSED");
} else if ((event.getModifiers() & ActionEvent.SHIFT_MASK) ==
ActionEvent.SHIFT_MASK) {
System.out.println("SHIFT KEY PRESSED");
} else if ((event.getModifiers() & ActionEvent.ALT_MASK) ==
ActionEvent.ALT_MASK) {
System.out.println("ALT KEY PRESSED");
} else if ((event.getModifiers() & ActionEvent.META_MASK) ==
ActionEvent.META_MASK) {
System.out.println("META KEY PRESSED");
} else {
System.out.println("NO KEY PRESSED");
}
I hope this helps.
Thanks and regards,
Janak
-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] Behalf Of Brohl Michael
Sent: Tuesday, May 22, 2007 2:03 PM
To: [email protected]
Subject: [ULC-developer] how to determine if CTRL key is pressed during
ActionEvent?
Hi,
I want to determine if the CTRL key was pressed during an ActionEvent
(clicking on a table column header with the mouse in my case).
I found that ActionEvent.getModifiers() delivers a combination of the four
constants (CTRL_MASK, ALT_MASK, SHIFT_MASK, META_MASK) and another one with
int value 16 which seems to be set in every case, even if not modifier key
was typed at all. But I cannot find a constant for this.
It would be great if anyone has more information especially the name of the
constant to use for the value 16.
Thanks and regards,
Michael
_______________________________________________
ULC-developer mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/ulc-developer