(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.

Thanks!

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

Ahha - that's where it was hiding!

Thanks!



:smiley:





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 );


*shrug*

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:
http://www.coderanch.com/t/341523/Swing-AWT-SWT-JFace/java/getLockingKeyState-setLockingKeyState-unreliable
http://bugs.sun.com/bugdatabase/view_bug.do;jsessionid=829bf261517dcffffffffd57c0d43545ab1d?bug_id=6446665