I'm currently working on a small game in Java (Swing). The avatar is controlled with the arrow keys. The main menu contains a JComboBox
.
If you don't select something from it the avatar is controllable via the arrow keys. However if you select something new, the keyPressed(KeyEvent e)
won't react on any key press.
What am I missing with the JComboBox? Thanks in advance.
Asked
Active
Viewed 11 times
0

Silent Tree
- 987
- 1
- 7
- 16
-
Could you add pictures of the game so we can understand – midugh Apr 25 '20 at 22:06
-
Don't use a KeyListener. Instead use [Key Bindings](https://docs.oracle.com/javase/tutorial/uiswing/misc/keybinding.html) – Hovercraft Full Of Eels Apr 25 '20 at 22:07
-
[For example](https://stackoverflow.com/a/8961998) – Hovercraft Full Of Eels Apr 25 '20 at 22:08
-
Thanks. Don't know why I didn't find that post – Silent Tree Apr 25 '20 at 22:09