KeyAdapter listener works in Windows, not on Mac

前端 未结 1 553
萌比男神i
萌比男神i 2021-01-25 09:26

I created a simple Nibbles (Snakes) game and everything works perfectly.

However, when I copy everything over to my mac (develop on a PC) and compile the same java files

相关标签:
1条回答
  • 2021-01-25 09:54

    use KeyBindings instead of KeyListener, KeyListener isn't designated for listening KeyEvents in the Swing JComponents, this's listener for AWT Components, example here

    0 讨论(0)
提交回复
热议问题