예제 #1
0
파일: GUI.java 프로젝트: BNHeadrick/AFM-GUI
    public int compareTo(Object otherTick) {
      if (!(otherTick instanceof Tick)) {
        throw new ClassCastException("Not a valid Tick object!");
      }

      Tick tempTick = (Tick) otherTick;

      if (this.getTimeStamp() > tempTick.getTimeStamp()) {
        return 1;
      } else if (this.getTimeStamp() < tempTick.getTimeStamp()) {
        return -1;
      } else {
        return 0;
      }
    }
예제 #2
0
파일: GUI.java 프로젝트: BNHeadrick/AFM-GUI
      // displays the timeline box and the ticks.
      public void display() {
        noStroke();
        fill(204);
        // timeline
        rect(xpos, ypos, swidth, sheight);
        if (over || locked) {
          fill(0, 0, 0);
        } else {
          fill(102, 102, 102);
        }
        // scrubber
        // println(spos);
        rect(spos - sheight / 2, ypos, sheight, sheight);

        for (int i = 0; i < tickArr.size(); i++) {
          tickArr.get(i).displayTick();
        }

        prevTick = null;
        nextTick = null;

        for (int i = 0; i < tickArr.size(); i++) {
          if (tickArr.get(i).getXPos() < spos) {
            prevTick = tickArr.get(i);
          } else {
            break;
          }
        }

        for (int i = 0; i < tickArr.size(); i++) {
          if (tickArr.get(i).getXPos() > spos) {
            nextTick = tickArr.get(i);
            break;
          }
        }

        if (prevTick != null) {
          prevTick.changeCamColorPrev();
        }
        if (nextTick != null) {
          nextTick.changeCamColorNext();
        }
      }