I'm implementing a class X that extends javax.swing.JFrame I added the inner class KeyInputHandler inside X with the following code:
private class KeyInputHandler extends KeyAdapter {
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_LEFT) {
}
if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
...
}
if (e.getKeyCode() == KeyEvent.VK_UP) {
...
}
if (e.getKeyCode() == KeyEvent.VK_SPACE) {
...
}
if (e.getKeyCode() == KeyEvent.VK_B) {
...
}
}
}
But for some reason it doesn't recognize my input. Do I have to add something else to the class X?