示例#1
0
  public void keyPressed(KeyEvent e) {

    System.out.println("Pressed: " + e.getKeyCode());
    direction.setKeyPressed(e.getKeyCode(), true);

    if (isMoving == false) {
      characterAssocié.setMoving(true);
      isMoving = true;
    }
    if (direction.isHeJumping()) {
      characterAssocié.setFalling(true);
      characterAssocié.jump(400);
    }
    if (direction.isToTheLeft()) characterAssocié.setVitesseHorizontal(300);
    else if (direction.isToTheRight()) characterAssocié.setVitesseHorizontal(-300);
    if (direction.isClimbing()) {
      characterAssocié.setFalling(true);
      characterAssocié.setVitesseVertical(-200);
    }

    if (direction.isPressedDown()) characterAssocié.setVitesseVertical(200);

    if (e.getKeyCode() == KeyEvent.VK_ENTER) {
      characterAssocié.setPositionX(300);
      characterAssocié.setPositionY(300);
      characterAssocié.setFalling(false);
      characterAssocié.setMoving(false);
    }
  }
 @Override
 public void keyPressed(KeyEvent e) {
   TreePath path = myTree.getLeadSelectionPath();
   if (path == null) return;
   final Object lastComponent = path.getLastPathComponent();
   if (e.getKeyCode() == KeyEvent.VK_ENTER) {
     if (lastComponent instanceof ParentNode) return;
     doOKAction();
     e.consume();
   } else if (e.getKeyCode() == KeyEvent.VK_INSERT) {
     if (lastComponent instanceof ElementNode) {
       final DefaultMutableTreeNode node = (DefaultMutableTreeNode) lastComponent;
       if (!mySelectedNodes.contains(node)) {
         if (node.getNextNode() != null) {
           myTree.setSelectionPath(new TreePath(node.getNextNode().getPath()));
         }
       } else {
         if (node.getNextNode() != null) {
           myTree.removeSelectionPath(new TreePath(node.getPath()));
           myTree.setSelectionPath(new TreePath(node.getNextNode().getPath()));
           myTree.repaint();
         }
       }
       e.consume();
     }
   }
 }
示例#3
0
  @Override
  public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
      System.exit(0);
    }

    // TODO Auto-generated method stub
    if (state == 1) // we are in a story
    {
      if (fadeCounter < FADETIMELIMIT) {
        fadeCounter = FADETIMELIMIT;
        oldbg = bg;
      }

      fadeUpdate = true;
      fadeCounter = 0;
      progress(); // keep going
    } else if (state == 2) {
      if (e.getKeyCode() == KeyEvent.VK_1) {
        index = next(tag, index, 1);
        progress();
      } else if (e.getKeyCode() == KeyEvent.VK_2) {
        index = next(tag, index, 2);
        progress();
      } else if (e.getKeyCode() == KeyEvent.VK_3) {
        index = next(tag, index, 3);
        progress();
      }
    }
  }
  @Override
  public void keyPressed(final KeyEvent e) {
    //		System.out.println( "MouseAndKeyHandler.keyPressed()" );
    update();

    if (e.getKeyCode() == KeyEvent.VK_SHIFT) {
      shiftPressed = true;
    } else if (e.getKeyCode() == KeyEvent.VK_META) {
      metaPressed = true;
    } else if (e.getKeyCode() != KeyEvent.VK_ALT
        && e.getKeyCode() != KeyEvent.VK_CONTROL
        && e.getKeyCode() != KeyEvent.VK_ALT_GRAPH) {
      pressedKeys.add(e.getKeyCode());

      final int mask = getMask(e);

      for (final BehaviourEntry<DragBehaviour> drag : keyDrags) {
        if (!activeKeyDrags.contains(drag) && drag.buttons.matches(mask, pressedKeys)) {
          drag.behaviour.init(mouseX, mouseY);
          activeKeyDrags.add(drag);
        }
      }

      for (final BehaviourEntry<ClickBehaviour> click : keyClicks) {
        if (click.buttons.matches(mask, pressedKeys)) {
          click.behaviour.click(mouseX, mouseY);
        }
      }
    }
  }
示例#5
0
文件: SG.java 项目: automenta/jcog
 public void keyReleased(KeyEvent e) {
   if (e.getKeyCode() == KeyEvent.VK_CONTROL) {
     keyStates.put(KeyStates.CONTROL, false);
   } else if (e.getKeyCode() == KeyEvent.VK_ALT) {
     keyStates.put(KeyStates.ALT, false);
   }
 }
 public void keyPressed(KeyEvent event) {
   if (event.getKeyCode() == KeyEvent.VK_ESCAPE) {
     actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "cancel"));
   }
   if (event.getKeyCode() == KeyEvent.VK_ENTER)
     actionPerformed(new ActionEvent(this, ActionEvent.ACTION_PERFORMED, "cancel"));
 }
示例#7
0
  // 定义a w s d为控制坦克移动的四个键
  @Override
  public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_W) {
      // 设置我的坦克的方向
      this.myTank.setDirect(0);
      myTank.moveUp();
    } else if (e.getKeyCode() == KeyEvent.VK_D) {
      this.myTank.setDirect(1);
      myTank.moveRight();
    } else if (e.getKeyCode() == KeyEvent.VK_S) {
      this.myTank.setDirect(2);
      myTank.moveDown();
    } else if (e.getKeyCode() == KeyEvent.VK_A) {
      this.myTank.setDirect(3);
      myTank.moveLeft();
    }
    // 开火
    if (e.getKeyCode() == KeyEvent.VK_J) {
      // 只能发射5颗子弹限制
      if (this.myTank.bb.size() < 5) {
        this.myTank.shoot();
      }
    }

    this.repaint();
  }
示例#8
0
  // ***************** KeyListener ****************
  @Override
  public void keyPressed(KeyEvent e) {
    // TODO Auto-generated method stub
    if (e.getKeyCode() == 8) // if delete key is pressed
    {
      MoleculeComponent currentElement = elist.getSelected();
      if (currentElement != null) {
        // Clear any lines being drawn (cancel connections)
        drawBondLine = false;
        drawArrowLine = false;

        elist.removeSelected();
        mmc.view.displayAttributes(null);

        repaint();
      }

    } else if (e.getKeyCode() == e.VK_ESCAPE) // if user hits ESC
    {
      if (drawBondLine == true) // and there is a bond being drawn
      {
        drawBondLine = false; // cancel that bond
        repaint();
      }
    }
  }
    public void keyPressed(KeyEvent keyEvent) {
      AppLogger.finest(
          "keyModifiers=" + keyEvent.getModifiers() + " keyCode=" + keyEvent.getKeyCode());

      int keyCode = keyEvent.getKeyCode();
      if (keyCode == KeyEvent.VK_SHIFT
          || keyCode == KeyEvent.VK_CONTROL
          || keyCode == KeyEvent.VK_ALT
          || keyCode == KeyEvent.VK_META) return;

      KeyStroke pressedKeyStroke = KeyStroke.getKeyStrokeForEvent(keyEvent);

      if (pressedKeyStroke.equals(lastKeyStroke)) {
        TableCellEditor activeCellEditor = getCellEditor();
        if (activeCellEditor != null) activeCellEditor.stopCellEditing();
      } else {
        String actionId;
        if ((actionId = data.contains(pressedKeyStroke)) != null) {
          String errorMessage =
              "The shortcut ["
                  + KeyStrokeUtils.getKeyStrokeDisplayableRepresentation(pressedKeyStroke)
                  + "] is already assigned to '"
                  + ActionProperties.getActionDescription(actionId)
                  + "'";
          tooltipBar.showErrorMessage(errorMessage);
          createCancelEditingStateThread(getCellEditor());
        } else {
          lastKeyStroke = pressedKeyStroke;
          setText(KeyStrokeUtils.getKeyStrokeDisplayableRepresentation(lastKeyStroke));
        }
      }

      keyEvent.consume();
    }
示例#10
0
  public void keyReleased(KeyEvent key) {

    if (key.getKeyCode() == 37) {

      leftcheck = false;
      if (rightcheck) {
        player.ta = changet;
      } else {
        player.ta = 0;
      }
    }

    if (key.getKeyCode() == 39) {

      rightcheck = false;
      if (leftcheck) {
        player.ta = -changet;
      } else {
        player.ta = 0;
      }
    }

    if (key.getKeyCode() == 32) {

      grav = false;
    }
  }
 /** Metodo captura os eventos do teclado para ENETER e ESCAPE */
 public void keyPressed(KeyEvent e) {
   if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
     this.dispose();
     dimensao = -1;
   } else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
     if (ajuda.isFocusOwner()) {
       new Ajuda(Ajuda.AJUDA_SEGMENTACAO_BASICA);
     } else if (ok.isFocusOwner() || !ok.isFocusOwner() && !cancelar.isFocusOwner()) {
       foiOk = true;
       try {
         dimensao = Integer.parseInt(text.getText());
         if (dimensao < 1) {
           JOptionPane.showMessageDialog(
               null,
               "Selecione o valor do limiar (maior que 0)",
               "ERRO NAS INFORMAÇÕES",
               JOptionPane.ERROR_MESSAGE);
           text.setText("");
         } else dispose();
       } catch (Exception ex) {
         JOptionPane.showMessageDialog(
             null,
             "Selecione o valor do limiar (maior que 0)",
             "ERRO NAS INFORMAÇÕES",
             JOptionPane.ERROR_MESSAGE);
         text.setText("");
         foiOk = false;
         dimensao = -1;
       }
     } else {
       this.dispose();
       dimensao = -1;
     }
   }
 }
示例#12
0
  private void XPasswordKeyPressed(
      java.awt.event.KeyEvent evt) { // GEN-FIRST:event_XPasswordKeyPressed

    if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
      char[] pass = XPassword.getPassword();
      String password = "";
      for (int i = 0; i < pass.length; i++) {
        password = password + pass[i];
      }
      if (password.length() == 0) {
        JOptionPane.showMessageDialog(this, "กรุณาป้อนรหัสอนุมัติ...!!!");
      } else {
        if (PasswordOK(password)) {
          ValidPassword = true;
          this.dispose();
        } else {
          JOptionPane.showMessageDialog(this, "ป้อนรหัสผ่านไม่ถูกต้อง...!!!");
          ValidPassword = false;
          XPassword.setText("");
        }
      }
    }
    if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) {
      ValidPassword = false;
      this.dispose();
    }
  } // GEN-LAST:event_XPasswordKeyPressed
示例#13
0
 public void keyPressed(KeyEvent event) {
   msg1 = "";
   System.out.println("keyPressed " + event.getKeyCode());
   if (event.getKeyChar() == KeyEvent.CHAR_UNDEFINED) {
     int key = event.getKeyCode();
     // Funktionstaste abfragen
     if (key == KeyEvent.VK_F1) {
       msg1 = "F1";
     } else if (key == KeyEvent.VK_F2) {
       msg1 = "F2";
     } else if (key == KeyEvent.VK_F3) {
       msg1 = "F3";
     }
     // Modifier abfragen
     if (msg1.length() > 0) {
       if (event.isAltDown()) {
         msg1 = "ALT + " + msg1;
       }
       if (event.isControlDown()) {
         msg1 = "STRG + " + msg1;
       }
       if (event.isShiftDown()) {
         msg1 = "UMSCHALT + " + msg1;
       }
     }
   }
   repaint();
 }
示例#14
0
 void jTextFieldSendMessages_keyPressed(KeyEvent e) {
   if (e.getKeyCode() == e.VK_DOWN) {
     String s = msgHistory.forward();
     if (s != null) {
       jTextFieldSendMessages.setText(s);
     }
   } else if (e.getKeyCode() == e.VK_UP) {
     String s = msgHistory.back();
     if (s != null) {
       jTextFieldSendMessages.setText(s);
     }
   } else if (e.getKeyChar() == '\n') {
     String body = jTextFieldSendMessages.getText();
     if (body.length() > 0) {
       if (body.charAt(body.length() - 1) == '\n') body = body.substring(0, body.length() - 1);
       String subject = jTextFieldSendSubject.getText();
       if (subject.length() > 0) {
         if (subject.charAt(subject.length() - 1) == '\n')
           subject = subject.substring(0, subject.length() - 1);
       }
       if (session != null && session.isConnected()) {
         session.postMessage(jTextFieldTargetUser.getText(), subject, body);
         displaySendMessage(subject, jTextFieldTargetUser.getText(), body, outgoingMsgAttrSet);
       }
       msgHistory.add(body);
       subjectHistory.add(subject);
       subjectHistory.reset();
       msgHistory.reset();
       jTextFieldSendMessages.setText("");
       jTextFieldSendSubject.setText("");
     }
   }
 }
示例#15
0
 @Override
 public void keyReleased(KeyEvent e) {
   keysDown.remove(Integer.valueOf(e.getKeyCode()));
   keysPressed.remove(Integer.valueOf(e.getKeyCode()));
   cacheKeysPressed.remove(Integer.valueOf(e.getKeyCode()));
   keysReleased.add(e.getKeyCode());
 }
示例#16
0
 // #{GxwCbkHost_
 public static final boolean ExecKeyEvent(GxwCbkHost host, KeyEvent e) {
   boolean rv = true;
   int id = e.getID(), val = e.getKeyCode();
   boolean isAltF4 = false;
   if (e.isAltDown() && val == IptKey_.F4.Val()) {
     isAltF4 = true;
   }
   if (id == KeyEvent.KEY_TYPED) {
     IptEvtDataKeyHeld keyHeldData = IptEvtDataKeyHeld.char_(e.getKeyChar());
     rv = host.KeyHeldCbk(keyHeldData);
     if (keyHeldData.Handled()) rv = false;
   } else {
     if (e.isShiftDown()) val |= IptKey_.Shift.Val();
     if (e.isControlDown()) val |= IptKey_.Ctrl.Val();
     if (e.isAltDown()) val |= IptKey_.Alt.Val();
     IptEvtDataKey keyData = IptEvtDataKey.int_(val);
     //			Tfds.Write(e.getKeyChar(), e.getKeyCode(), val, id);
     if (id == KeyEvent.KEY_PRESSED) rv = host.KeyDownCbk(keyData);
     else if (id == KeyEvent.KEY_RELEASED) rv = host.KeyUpCbk(keyData);
     if (keyData.Handled()) rv = false; // was false
   }
   if (isAltF4) {
     e.consume();
   }
   if (e.getKeyCode() == KeyEvent.VK_ALT)
     e.consume(); // force consume of alt-keys; occurs when alt-f4ing out of video app (though
   // not audio app)
   return rv;
 }
示例#17
0
 /** Metodo captura os eventos do teclado para ENETER e ESCAPE */
 public void keyPressed(KeyEvent e) {
   if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
     ok = false;
     modelo = "";
     this.dispose();
   } else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
     if (buttonAjuda.isFocusOwner()) {
       new Ajuda(Ajuda.AJUDA_DECOMPOR_CANAIS);
     } else if (buttonOk.isFocusOwner()
         || !buttonOk.isFocusOwner() && !buttonCancel.isFocusOwner()) {
       ok = true;
       if (modelo.equals("")) {
         JOptionPane.showMessageDialog(
             null,
             "Selecione a operação desejada",
             "ERRO NAS INFORMAÇÕES",
             JOptionPane.ERROR_MESSAGE);
       } else dispose();
     } else {
       ok = false;
       modelo = "";
       this.dispose();
     }
   }
 }
示例#18
0
  public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_UP) {
      if (x > 20) {
        x -= 5;

        // y+=5;
      }
    } else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
      x += 10;

      // if(y>0)
      // y--;
    } else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
      if (position == 2) {
        position = 1;

        car.setBounds(120, 500, 120, 70);
      }
      if (position == 3) {
        position = 2;
        car.setBounds(240, 500, 120, 70);
      }
    } else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
      if (position == 2) {
        position = 3;
        car.setBounds(360, 500, 120, 70);
      }
      if (position == 1) {
        position = 2;

        car.setBounds(240, 500, 120, 70);
      }
    }
  }
示例#19
0
  public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_ESCAPE && gamerunner.running) {

      Graphics gr = this.getGraphics();
      gr.setFont(new Font("TimesRoman", Font.PLAIN, 40));
      gr.drawString("PAUSE", (int) this.getWidth() / 2, this.getHeight() / 2);
      if (!online) {
        gamerunner.running = false;
      }
      if (soundan) {} // end of if
      Menu menu = new Menu(this);
      // volume.setValue(vol);
    } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
      gamerunner.running = true;
      if (soundan) {} // end of if
    } // end of if-else
    else if (e.getKeyCode() == KeyEvent.VK_R && !online) {
      restartGame();
    } else if (e.getKeyCode() == KeyEvent.VK_F11) {
      dispose();
      setUndecorated(true);
      String[] arguments = {"fullscreen"};
      new JavaGame(arguments);
    } else if (e.getKeyCode() == KeyEvent.VK_ENTER && online) {
      String message =
          JOptionPane.showInputDialog(null, "Chat", "Nachricht", JOptionPane.PLAIN_MESSAGE);
      try {
        if (!message.isEmpty()) {
          client.sendNewChatMessage(player[client.id].name, message);
        }
      } catch (IOException e1) {
        e1.printStackTrace();
      }
    }
  }
示例#20
0
    public void keyPressed(KeyEvent e) {
      if (e.getKeyCode() == KeyEvent.VK_P) {
        if (pauseFlag) { // eğer oyun pause halindeyse
          startTimer();
          pauseFlag = false;
          // pause paneli görünmez yap
          // pp.setVisible(false);

        } else { // oyun oynanırken P ye basılırsa/pause haline geçilirse
          stopTimer();
          pauseFlag = true;

          //        			CardLayout c1 = (CardLayout)(mgf.getCanvas().getLayout());
          //        			c1.show(mgf.getCanvas(), "Pause Panel");
          System.out.println("Paused by game manager");
        }
      }

      if (e.getKeyCode() == KeyEvent.VK_Q) {

        System.out.println("Q pressed");
        // oyunu pause lamak faln gerekeblir
        gm.resetGameLevel();
        gm.resetGamePoint();
        gm.initGame();

        CardLayout c2 = (CardLayout) (mgf.getCanvas().getLayout());
        c2.show(mgf.getCanvas(), "GUI");
      }
    }
示例#21
0
    public void keyPressed(KeyEvent keyEvent) {
      keyEvent.getKeyCode();

      if (keyEvent.getKeyCode() == KeyEvent.VK_ESCAPE) {
        System.exit(0);
      }
    }
示例#22
0
  @Override
  public void keyReleased(KeyEvent e) {
    int key = e.getKeyCode();
    _cursor = _textField.getCaretPosition();

    // ensure key pressed was not arrow key or shift key before updating suggestions
    if (key != KeyEvent.VK_UP
        && key != KeyEvent.VK_DOWN
        && key != KeyEvent.VK_LEFT
        && key != KeyEvent.VK_RIGHT
        && key != KeyEvent.VK_SHIFT
        && key != KeyEvent.VK_CONTROL) {

      String text = _textField.getText();
      int len = text.length();
      if (len != _prevLen) {
        updateSuggestions(text);
        _prevLen = len;
      }
    }

    if (e.getKeyCode() == KeyEvent.VK_ENTER) {
      this.hidePopup();
    }
  }
示例#23
0
文件: SG.java 项目: automenta/jcog
 public void keyPressed(KeyEvent e) {
   if (e.getKeyCode() == KeyEvent.VK_CONTROL) {
     keyStates.put(KeyStates.CONTROL, true);
   } else if (e.getKeyCode() == KeyEvent.VK_ALT) {
     keyStates.put(KeyStates.ALT, true);
   }
 }
示例#24
0
    @Override
    public void keyPressed(KeyEvent evt) {
      if (evt.isConsumed()) return;
      Component comp = getFocusOwner();
      if (evt.getKeyCode() == KeyEvent.VK_ENTER && enterEnabled) {
        while (comp != null) {
          if (comp instanceof JComboBox) {
            JComboBox<?> combo = (JComboBox<?>) comp;
            if (combo.isEditable()) {
              Object selected = combo.getEditor().getItem();
              if (selected != null) combo.setSelectedItem(selected);
            }

            if (combo.isPopupVisible()) {
              evt.consume();
              combo.setPopupVisible(false);
            }
            return;
          }
          // TODO: add other classes that need custom key handling here.
          comp = comp.getParent();
        }
        evt.consume();
        ok();
      } else if (evt.getKeyCode() == KeyEvent.VK_ESCAPE || isCloseBufferShortcut(evt)) {
        evt.consume();
        if (comp instanceof JComboBox) {
          JComboBox<?> combo = (JComboBox<?>) comp;
          if (combo.isPopupVisible()) combo.setPopupVisible(false);
          else cancel();
        } else cancel();
      }
    }
示例#25
0
  /*
   * if an action key is released the coressponding boolean becomes false end
   * the action is not executed any more
   **/
  public void keyReleased(KeyEvent e) {
    if (e.getKeyCode() == fire) {
      dropBombKeyPressed = false;
      interrupt();
    }

    if (e.getKeyCode() == left) {
      leftKeyPressed = false;
      enable = true;
      interrupt();
    }
    if (e.getKeyCode() == up) {
      upKeyPressed = false;
      enable = true;
      interrupt();
    }

    if (e.getKeyCode() == right) {
      rightKeyPressed = false;
      enable = true;
      interrupt();
    }
    if (e.getKeyCode() == down) {
      downKeyPressed = false;
      enable = true;
      interrupt();
    }
  }
  /**
   * after the key is released the boolean is set to false
   *
   * @param e key released event
   */
  public void keyReleased(KeyEvent e) {

    if (e.getKeyCode() == LEFT) SpaceInvaders.keysPressed.set(0, false);
    if (e.getKeyCode() == RIGHT) SpaceInvaders.keysPressed.set(1, false);
    if (e.getKeyCode() == DOWN) SpaceInvaders.keysPressed.set(2, false);
    if (e.getKeyCode() == UP) SpaceInvaders.keysPressed.set(3, false);
  }
示例#27
0
 void objectTable_keyTyped(KeyEvent e) {
   if (e.getKeyCode() == KeyEvent.VK_DELETE) {
     removeCurrent();
   } else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
     editCurrent();
   }
 }
示例#28
0
  /** 键盘按下 */
  public void keyPressed(KeyEvent e) {

    int code = e.getKeyCode();
    if (e.getModifiers() == InputEvent.ALT_MASK && e.getKeyCode() == KeyEvent.VK_F4) {
      if (handler != null) {
        handler.getScene().close();
      }
    }
    try {
      this.onKey(e);
      if (!keyDown[code & 0xFF]) {
        keyDown[code & 0xFF] = true;
        keyPressed[this.pressedKey] = code;
        this.pressedKey++;
        if (keyMap.size() > 0) {
          Action action = (Action) keyMap.get(String.valueOf(code));
          if (action != null) {
            action.press();
          }
        }
      }
      e.consume();
    } catch (Exception ex) {
      pressedKey = 0;
    }
  }
示例#29
0
  @Override
  public void keyPressed(KeyEvent e) {
    // TODO Auto-generated method stub
    if (e.getKeyCode() == KeyEvent.VK_W) {
      this.hero.setDirection(0);
      hero.moveUp();
    } else if (e.getKeyCode() == KeyEvent.VK_D) {
      this.hero.setDirection(1);
      hero.moveRight();
    } else if (e.getKeyCode() == KeyEvent.VK_S) {
      this.hero.setDirection(2);
      hero.moveDown();
    } else if (e.getKeyCode() == KeyEvent.VK_A) {
      this.hero.setDirection(3);
      hero.moveLeft();
    }
    // 判断玩家是否按下J键 则开火
    if (e.getKeyCode() == KeyEvent.VK_J) {
      if (this.hero.bombs.size() <= 40) {

        hero.fire();
      }
    }
    this.repaint();
  }
示例#30
0
 protected void processKeyEvent(final KeyEvent e) {
   int id = e.getID();
   switch (id) {
     case KeyEvent.KEY_TYPED:
       KeyEventCZ loKey = new KeyEventCZ(e.getKeyChar());
       moTipo.getTecla(super.getText(), loKey);
       e.setKeyChar(loKey.getKeyChar());
       break;
     case KeyEvent.KEY_PRESSED:
       if (e.getKeyCode() == e.VK_ENTER) {
         e.setKeyCode(0);
         transferFocus();
       }
       if (e.getKeyCode() == e.VK_ESCAPE) {
         e.setKeyCode(0);
         moTipo.restaurarTexto();
         super.setText(moTipo.getText());
       }
       break;
     case KeyEvent.KEY_RELEASED:
       break;
     default:
   }
   super.processKeyEvent(e);
 }