Reputation:
I am trying to use KeyListener
to input information, such as using the arrow keys to move an object in a plane, but as soon as I press my first key, the error below is thrown:
2021-05-20 09:55:35.400 java[36269:3330310] TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED Inhibit
My code is like this:
KeyListener listener = new KeyAdapter() {
public void keyTyped(KeyEvent e) {
int key = e.getKeyCode();
if (key == KeyEvent.VK_KP_UP) {
if (x != 5) {
x -= 10;
repaint();
}
}
if (key == KeyEvent.VK_KP_RIGHT){
if (x != 495) {
x += 10;
repaint();
}
}
if (key == KeyEvent.VK_KP_DOWN) {
if (y != 375) {
y += 10;
repaint();
}
}
if (key == KeyEvent.VK_KP_UP) {
if (y != 5) {
y -= 10;
repaint();
}
}
}
};
Everything in this code works properly. I am using a 2019 MacBook 16-inch. I am implementing codes on Eclipse. Is there any way that this problem can be solved?
Upvotes: 3
Views: 10751
Reputation: 1
Change your keyboard Hotkey at Preference/Keyboard/HotKey/input method If your first key is CapLock, the error will show. Change the input method HotKey will solve.
Upvotes: 0