Код: Выделить всё
2021-05-20 09:55:35.400 java[36269:3330310] TSM AdjustCapsLockLEDForKeyTransitionHandling - _ISSetPhysicalKeyboardCapsLockLED InhibitКод: Выделить всё
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();
}
}
}
};
Подробнее здесь: https://stackoverflow.com/questions/676 ... onhandling
Мобильная версия