Well before I tried adding "addKeyListener(this)" to area where we create the frame. When i added "mainFrame.addKeyListener(this)" to the part I initialized other objects which is also after the creation of the mainFrame, my key listener started working.
Also i was wondering:
When i tried the keyboard input from the wiki, my vk_arrow keys do not work? Left, Right, Down, Up generate the same key instance and i'm not sure why. VK_ESCAPE works perfectly, but its these virtual arrow keys that make my program annoying. Sigh..

I know a user on these forums had posted a link to his online book: It was about java game programming and I found it really useful. He wasn't quite done with it, but the chapters he had finished were incredibly useful. But my computer got reformatted and I have lost the link.

