> Thirdly as rightly pointed out by Blake in the javadoc here > http://java.sun.com/j2se/1.3/docs/api/javax/swing/KeyStroke.html > you do intercept in java swing the keystrokes to a certain > extent. > > Having parsed the javadoc of KeyStroke my conclusion is > that KeyStroke doesn't take into consideration the state > of CAPS LOCK, therefore when CAPS LOCK is activated the > combination CTRL + SHIFT + 'd' is equivalent to CTRL + 'd' > and the combination CTRL + 'd' is equivalent to > CTRL + SHIFT + 'd': CAPS LOCK inverts your keyboard. > > So you still have to check in your code the real scan code > value, which can be a nightmare, or invert the KeyStroke > received if CAPS LOCK is active.
However, as I've emailed Cedric, Java also has a KeyEvent, (at http://java.sun.com/j2se/1.3/docs/api/java/awt/event/KeyEvent.html ) which has two methods of interest: getKeyChar and getKeyCode. public char getKeyChar() Returns the character associated with the key in this event. For example, the key-typed event for shift + "a" returns the value for "A". Returns: the Unicode character defined for this key event. If no valid Unicode character exists for this key event, keyChar is CHAR_UNDEFINED. ------------------------------------------------------------------------ -------- public int getKeyCode() Returns the integer key-code associated with the key in this event. Returns: the integer code for an actual key on the keyboard. (For KEY_TYPED events, keyCode is VK_UNDEFINED.) Now, since the physical key won't change, no matter how many times you press and release the CapsLock key, we can assume that the keyCode won't change, and thus it corresponds to the real scan code, making it trivial to implement the functionality the way it should be implemented. (IMHO ;) I'm guessing that it's a typo on the part of the IntelliJ folks, and we'll see it fixed in short order. Later, Blake. _______________________________________________ Eap-list mailing list [EMAIL PROTECTED] http://www.intellij.com/mailman/listinfo/eap-list
