Hi, Kedar -
Threads won't help you -- because the AWT
thread is the one responsible for handing out all of the key events -- but I think what you're trying to do is quite possible.
Look at the KeyListener interface again. If you implement the keyPressed
and keyReleased methods, you will be able to figure it out when one key is pressed and another is also pressed before the first is released.
Dealing with the modifier keys (i.e., Ctrl, Shift, Alt) is even easier. InputEvent (the superclass of KeyEvent) has methods isShiftDown(), isAltDown() and so on.
One caveat here: I tested this in WinNT, JDK 1.2. Obviously, there might be bugs in other configurations (i.e.,
Java 1.1 in an applet) that could prevent it from working properly...