コード例 #1
0
ファイル: NongFrame.java プロジェクト: lekro/Nong
 @Override
 public void keyPressed(KeyEvent ke) {
   if (this.isFocused()) {
     switch (ke.getKeyCode()) {
       case KeyEvent.VK_UP:
         if (keyPressed != KeyEvent.VK_UP) {
           keyPressed = KeyEvent.VK_UP;
           client.getNetworkThread().send(ClientCommand.UP);
         }
         break;
       case KeyEvent.VK_DOWN:
         if (keyPressed != KeyEvent.VK_DOWN) {
           keyPressed = KeyEvent.VK_DOWN;
           client.getNetworkThread().send(ClientCommand.DOWN);
         }
         break;
     }
   }
 }
コード例 #2
0
ファイル: NongFrame.java プロジェクト: lekro/Nong
 @Override
 public void keyReleased(KeyEvent ke) {
   if (keyPressed == -1) return;
   keyPressed = -1;
   switch (ke.getKeyCode()) {
     case KeyEvent.VK_UP:
     case KeyEvent.VK_DOWN:
       client.getNetworkThread().send(ClientCommand.STOP);
       break;
   }
 }