Hi.
I want to find out whether caps-lock is currently enabled.
I already google searched and found this method:
Unfortunately I also found out, that it doesnt always work on some platforms (*cough* windows *cough*). And, in fact, it does not work for me.try { result = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK); } catch (UnsupportedOperationException e) { result = false; }
Source: Bug ID: JDK-4414164 Toolkit.getLockingKeyState() does not return caps lock state
So, I would like to ask if anybody knew a better way.
I could poll the keyboard state and keep track of caps-lock on my own, but I would like not to do this. There must be a better way.
Thank you very much.