public void keyReleased(KeyEvent e) {
      int key = e.getKeyCode();

      if (position == 1 || position == 2)
      {
          if (key == KeyEvent.VK_LEFT) {
              dx = 0;
          }
          if (key == KeyEvent.VK_RIGHT) {
              dx = 0;
          }
      }
      else if (position == 3 || position == 4)
      {
          if (key == KeyEvent.VK_UP) {
              dy = 0;
          }
          if (key == KeyEvent.VK_DOWN) {
              dy = 0;
          }
      }
  }