How to Turn the Numlock and Capslock On and Off

4 years ago by in AWT, How To Tagged: , , ,

To turn the Numlock and the Capslock On you can use the following example

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

While to turn them off you can use the following examples

Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent. VK_NUM_LOCK, false);
Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false);
Albert Attard

Albert Attard is a Java passionate and technical lead at a research group. You can find him on . Over the past years Albert worked on various Java projects including traditional server/client applications, modular applications, large data handling applications and concurrent data manipulation applications to name a few. He has a BSc degree from the University of London (Homepage) and an MSc Information Security with the same university. His MSc thesis (Book) received the 2012 SearchSecurity.co.UK award (Website).

Leave a Comment