Exemple #1
0
    @Override
    public void keyPressed(KeyEvent evt) {
      switch (evt.getKeyCode()) {
        case KeyEvent.VK_SPACE:
          goToSelectedNode(M_OPEN);

          // f**k me dead
          EventQueue.invokeLater(
              new Runnable() {
                @Override
                public void run() {
                  resultTree.requestFocus();
                }
              });

          evt.consume();
          break;
        case KeyEvent.VK_ENTER:
          goToSelectedNode(M_OPEN);
          evt.consume();
          break;
        case KeyEvent.VK_DELETE:
          removeSelectedNode();
          evt.consume();
          break;
        default:
          break;
      }
    }
 // {{{ processKeyEvent() method
 public void processKeyEvents(KeyEvent ke) {
   if ((ke.getID() == KeyEvent.KEY_PRESSED) && (ke.getKeyCode() == KeyEvent.VK_ESCAPE)) {
     cancel();
     ke.consume();
   }
 } // }}}