The code below show you how to activate the Caps Lock button programmatically. Setting the locking state to Boolean.TRUE
will turn the Caps Lock on.
package org.kodejava.awt;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
public class TurnCapsLockOn {
public static void main(String[] args) throws Exception {
// Gets the default toolkit.
Toolkit toolkit = Toolkit.getDefaultToolkit();
// Update the locking state for caps lock button to true
// will turn the caps lock on.
toolkit.setLockingKeyState(KeyEvent.VK_CAPS_LOCK, Boolean.TRUE);
}
}
Latest posts by Wayan (see all)
- How do I create a table with multiple header in iText 8? - March 16, 2024
- How do I add Image to a Table in iText 8? - March 11, 2024
- How do I downgrade Android SDK emulator version? - February 12, 2024