I want to listen to keyboard inputs but i get no KeyCode, but the KeyListener have to be in an external class
Main.java:
public class Main {
    public static void main(String args[]){
        new Spielfeld("Spielfeld");
        new KeyEventListener();
    }
}
KeyEventListener.java
public class KeyEventListener implements KeyListener{
public KeyEventListener(){
}
@Override
public void keyPressed(KeyEvent e) {
    System.out.println(e.getKeyCode());
}
@Override
public void keyReleased(KeyEvent arg0) {}
@Override
public void keyTyped(KeyEvent arg0){}
}
Sorry, I'm new at Java and don't know how to fix this...
                        
You need to add
keyListenerto any component such as JTextField ,Here is a nice example :
More on listeners : Here