/** Invoked by PropertyChangeHandler. */
  private void cleanUpIndeterminateValues() {
    // stop the animation thread if necessary
    if (progressBar.isDisplayable()) {
      stopAnimationTimer();
    }

    cycleTime = repaintInterval = 0;
    numFrames = animationIndex = 0;
    maxPosition = 0;
    delta = 0.0;

    boxRect = nextPaintRect = null;
    componentInnards = oldComponentInnards = null;

    progressBar.removeHierarchyListener(getHandler());
  }
  /**
   * Invoked by PropertyChangeHandler.
   *
   * <p>NOTE: This might not be invoked until after the first paintIndeterminate call.
   */
  private void initIndeterminateValues() {
    initIndeterminateDefaults();
    // assert cycleTime/repaintInterval is a whole multiple of 2.
    numFrames = cycleTime / repaintInterval;
    initAnimationIndex();

    boxRect = new Rectangle();
    nextPaintRect = new Rectangle();
    componentInnards = new Rectangle();
    oldComponentInnards = new Rectangle();

    // we only bother installing the HierarchyChangeListener if we
    // are indeterminate
    progressBar.addHierarchyListener(getHandler());

    // start the animation thread if necessary
    if (progressBar.isDisplayable()) {
      startAnimationTimer();
    }
  }