Esempio n. 1
0
 public void keyPressed(KeyEvent e) {
   int key = e.getKeyCode();
   switch (key) {
     case KeyEvent.VK_LEFT:
       bL = true;
       break;
     case KeyEvent.VK_UP:
       bU = true;
       break;
     case KeyEvent.VK_RIGHT:
       bR = true;
       break;
     case KeyEvent.VK_DOWN:
       bD = true;
       break;
   }
   locateDirection();
 }
Esempio n. 2
0
 public void keyReleased(KeyEvent e) {
   int key = e.getKeyCode();
   switch (key) {
     case KeyEvent.VK_CONTROL:
       fire();
       break;
     case KeyEvent.VK_LEFT:
       bL = false;
       break;
     case KeyEvent.VK_UP:
       bU = false;
       break;
     case KeyEvent.VK_RIGHT:
       bR = false;
       break;
     case KeyEvent.VK_DOWN:
       bD = false;
       break;
   }
   locateDirection();
 }