To use the arrows, you're going to need to use getKeyCode()
, which returns an int. Doing it this way solves your capital letters problem, too. Like this:
int code = e.getKeyCode();
if (code == KeyEvent.VK_W) {
//do stuff
//repeat with VK_A, VK_S, and VK_D
}
All the KeyEvent constants are ints underneath the hood anyway.