I'm trying to build a better username/password field for my workplace and would like to be able to complain when they have their caps lock on.
Is this possible? And if so I'd like to have it detected before the client types their first letter.
Is there a non-platform specific way to do this?
The getModifierState() method returns true if a modifier is active; otherwise, it returns false . The event. getModifierState('CapsLock') can be used to detect if the caps lock is on.
Try this, from java.awt.Toolkit, returns a boolean:
Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With