Please help me as this is my first time trying to use KeyListeners. Risk.java compiles fine.
Thanks,
cc11rocks

02-08-2011, 04:48 AM

Fubarable

If your class implements any interface it must implement all the methods of that interface. You have Risk implementing a KeyListener but you give it none of the methods of KeyListener.

Having said that, don't have your GUI implement listeners, including KeyListener and ActionListener. You're far better off using anonymous inner classes (if you don't understand what these are, look them up). Also, on an unrelated note you're often better off using key bindings not key listeners.

Finally, "this" has no meaning inside of a static class. But again, this wouldn't be an issue if you used anonymous inner classes.