Exemplo n.º 1
0
  /** {@inheritDoc} */
  public void keyReleased(PInputEvent event) {

    if (event.getKeyCode() == KeyEvent.VK_SHIFT) {
      press[0] = false;
    }

    if (event.getKeyCode() == KeyEvent.VK_UP) {
      press[1] = false;
    }

    if (event.getKeyCode() == KeyEvent.VK_DOWN) {
      press[2] = false;
    }

    if (event.getKeyCode() == KeyEvent.VK_R) {
      press[3] = false;
    }

    if (event.getKeyCode() == KeyEvent.VK_CONTROL) {
      press[4] = false;
    }

    if (event.getKeyCode() == KeyEvent.VK_C) {
      press[5] = false;
    }

    if (event.getKeyCode() == KeyEvent.VK_LEFT) {
      press[6] = false;
    }

    if (event.getKeyCode() == KeyEvent.VK_RIGHT) {
      press[7] = false;
    }

    if (event.getKeyCode() == KeyEvent.VK_V) {
      press[8] = false;
    }

    if (event.getKeyCode() == KeyEvent.VK_O) {
      press[9] = false;
    }

    if (event.getKeyCode() == KeyEvent.VK_D) {
      press[10] = false;
    }

    if (!press[0] || !press[10]) {
      GraphBuilder.setDeleteMode(false);
    }
  }
Exemplo n.º 2
0
  /** {@inheritDoc} */
  public void keyPressed(PInputEvent event) {

    if (event.getKeyCode() == KeyEvent.VK_SHIFT) {
      press[0] = true;
    }

    if (event.getKeyCode() == KeyEvent.VK_UP) {
      press[1] = true;
    }

    if (event.getKeyCode() == KeyEvent.VK_DOWN) {
      press[2] = true;
    }

    if (event.getKeyCode() == KeyEvent.VK_R) {
      press[3] = true;
    }

    if (event.getKeyCode() == KeyEvent.VK_CONTROL) {
      press[4] = true;
    }

    if (event.getKeyCode() == KeyEvent.VK_C) {
      press[5] = true;
    }

    if (event.getKeyCode() == KeyEvent.VK_LEFT) {
      press[6] = true;
    }

    if (event.getKeyCode() == KeyEvent.VK_RIGHT) {
      press[7] = true;
    }

    if (event.getKeyCode() == KeyEvent.VK_V) {
      press[8] = true;
    }

    if (event.getKeyCode() == KeyEvent.VK_O) {
      press[9] = true;
    }

    if (event.getKeyCode() == KeyEvent.VK_D) {
      press[10] = true;
    }

    if (press[0] && press[1]) {
      zoomIn();
    } else if (press[1]) {
      pan(UP);
    }
    if (press[0] && press[2]) {
      zoomOut();
    } else if (press[2]) {
      pan(DOWN);
    }
    if (press[0] && press[8]) {
      graph.switchCanvas();
    }
    if (press[0] && press[3]) {
      if (graph.getCurOp().equals("efg")) {
        graph.resetEFGView();
      } else {
        graph.resetTestView();
      }
    }
    if (press[4] && press[5]) {
      System.exit(0);
    }
    if (press[6]) {
      pan(LEFT);
    }
    if (press[7]) {
      pan(RIGHT);
    }
    if (press[4] && press[9]) {
      SwingUtilities.invokeLater(
          new Runnable() {
            public void run() {
              GUIBuilder.createAndShowGUI();
            }
          });
      graph.setVisible(false);
      graph.dispose();
    }
    if (press[0] && press[10]) {
      GraphBuilder.setDeleteMode(true);
    }
  }