I have some code that I need to modify. In the code, the original author uses KeyStroke.getKeyStroke to take user input. In this code, for example, he uses
KeyStroke.getKeyStroke
You should be able to use KeyStroke.getKeyStroke("DOWN");, "UP", "LEFT", "RIGHT", to do what you want.
KeyStroke.getKeyStroke("DOWN");
"UP"
"LEFT"
"RIGHT"
See the javadoc for more detail.