(Solved) KeyInput and Caps Lock

I was just setting up some keybinds and decided to use the caps lock key as a toggle keybind.

The keybind works perfectly well, however on exiting my game, the capslock state is still the same.

Is it possible to unset caps lock before the game ends? I've looked at the javadocs, but couldn't see anything useful.


in pure awt: Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false);

Ahha - that's where it was hiding!



Edit: I had to set capslock to on manually even if it was already on to get it to turn off properly (Windows XP):

Toolkit.getDefaultToolkit().setLockingKeyState( KeyEvent.VK_CAPS_LOCK, true );
Toolkit.getDefaultToolkit().setLockingKeyState( KeyEvent.VK_CAPS_LOCK, false );


Edit2: The above code fixed it for a bit, but then it just started turning capslock on, even if it was off to begin with
It looks like there are some issues with this in the awt code itself. Here are some somewhat relevant links: