To get key events you need to use either a key listener or key bindings.