Moving JLabel With Arrow Keys - NetBeans

Опубликовано: 04 Ноябрь 2024
на канале: Programming of Life
3,149
42

Moving JLabel With Arrow Keys - NetBeans

Java KeyListener methods

public abstract void keyPressed(KeyEvent e);
public abstract void keyReleased(KeyEvent e);
public abstract void keyTyped(KeyEvent e);

getKeyCode() - Returns the integer keyCode associated with the key in this event.

JLabel by default transparent, if you want to change background color
use opaque property.
setOpaque(boolean value)