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
use KeyBindings instead of KeyListener, KeyListener isn't designated for listening KeyEvents in the Swing JComponents, this's listener for AWT Components, example here
KeyBindings
KeyListener
KeyEvents