Пример #1
0
 protected void repositionTimeRects() {
   if (timeRects != null) {
     for (TimeRect timeRect : timeRects) {
       timeRect.reposition();
     }
   }
 }
Пример #2
0
  @Override
  public void mouseReleased(MouseEvent evt) {
    if (!isEnabled()) {
      return; // allow no mouse actions when the editor is not enabled
    }
    // mouse must be moved 5px before creating a rect
    if (xDragStart == -1
        || Math.abs(evt.getX() - xDragStart) + Math.abs(evt.getY() - yDragStart) > 5) {
      int day2 = Math.min(day0, day1);
      int day3 = Math.max(day0, day1);
      int minute2 = Math.min(minute0, minute1);
      int minute3 = Math.max(minute0, minute1);

      TimeRect timeRect = new TimeRect(OheEditor.this, day2, day3, minute2, minute3);
      timeRects.add(timeRect);
      contentPanel.add(timeRect);
      timeRect.reposition();
      dialog.updateValueField(timeRects);

      day0 = -1;
      repaint();
    }
  }