Instead of sending the switch statement the keyPressed variable, just send it: e.getKeyCode()
e is the KeyEvent parameter of the method.
Type: Posts; User: aussiemcgr
Instead of sending the switch statement the keyPressed variable, just send it: e.getKeyCode()
e is the KeyEvent parameter of the method.
Constants are just values. So, you can say:
switch(someKey) {
case KeyEvent.VK_W:
do something;
break;
case KeyEvent.VK_S:
do something;
break;
...
A few suggestions from my point of view:
1. Class Variables that you intend on ONLY being used inside of the class, should be set to private instead of public (or protected if you think the variable...