posted 7 years ago
Yes the Canvas class provides three callback method keyPress(), keyReleased() and keyRepeated(). As the name suggest they are called when you do something with the key. As far as I understand, the Board class need to implement CommandListener interface because it included a exit command. The must have method for CommandListener class is commandAction() method, So you need to exclusively define this method in the Board Class which extends Canvas class and implements the CommandListener Interface.