Is there a way to turn on / off the backlight of Num, Caps and Scroll Lock?

Is there a way to turn on / off the backlight of Num, Caps and Scroll Lock? It's just for fun, and my idea is to make something like a disco.

+3
source share
3 answers

Try

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

to set caps lock on.

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

to set the caps off lock.

and

boolean isCapsLockOn = Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK);

to get the current status.

use KeyEvent.VK_NUM_LOCKto lock num.

I tested this on windows. I'm not sure about other OSs, but I think it will work.

+4
source
0
source

, Caps/Scroll .

, (, , - , ), java.

, cap-lock?, #.

, .

-1

All Articles