Implemented a KeyListener for JFrame window