Ejemplo 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();
 }
Ejemplo 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();
 }