Trying to use java to implement keyboard event listeners