How to detect user key presses such as conrtrol-P, control-S, and control-M
Nate Lockwood
Ranch Hand
Joined: Feb 22, 2010
Posts: 75
posted
0
I have a GUI (JFrame) with 3 panels. I'd like the user to be able to type control-key pairs such as: control-P to start a print job and control-S to save but don't see how to do this with KeyListener.
If the "if" statement is removed or I change the if statement to if (!arg0.isControlDown()) { the switch works whether the control key is pressed or not. Otherwise nothing happens. I'm on OS-X right now and need this to work with LINUX as well (and probably MS XP at some point).