Ejemplo n.º 1
0
  // process a mouseClicked event
  // select the loop if the mouse was clicked within the edges of
  // the border
  public void mouseClicked(MouseEvent mouseEvent) {
    int x = mouseEvent.getX();
    int y = mouseEvent.getY();

    Rectangle bounds = getBounds();

    // left, top, bottom, right edge
    if ((x >= 0 && x <= SELECT_BORDER_SIZE)
        || (y >= 0 && y <= SELECT_BORDER_SIZE)
        || (y >= bounds.height - SELECT_BORDER_SIZE && y <= bounds.height)
        || (x >= bounds.width - SELECT_BORDER_SIZE && x <= bounds.width)) {
      if (isSelected()) program.setAllSelected(false);
      else {
        program.setAllSelected(false);
        setSelected(true);
        program.updateLoopDialog();
      }
      program.updateState();
      repaint();
    } else super.mouseClicked(mouseEvent);
  }
Ejemplo n.º 2
0
 // set the selection state and update the GUI and loop dialog
 public void setSelected(boolean flag) {
   super.setSelected(flag);
   program.updateState();
   program.updateLoopDialog();
 }