Example #1
0
  /**
   * Starts the progress displaying. Should be called at the start of the process whose progress is
   * to be displayed.
   */
  public void start() {

    step = 0;
    update = 0;
    percent = 0;
    progress();
  }
Example #2
0
  /** Increases the internal step counter. */
  public void step() {

    if (steps > 0) {
      ++step;
      percent = step / steps;
      final int pup = (int) (percent * updates);
      if (pup > update) {
        update = pup;
        progress();
      }
    }
  }
Example #3
0
  /**
   * Increases the internal step counter by the given amount.
   *
   * @param n the number of steps to be added to the internal step counter.
   * @exception IllegalArgumentException if {@code n} is less than {@code 0}.
   */
  public void step(final int n) {

    if (n < 0) throw new IllegalArgumentException("Number of steps less than 0");
    if (steps > 0) {
      step += n;
      percent = step / steps;
      final int pup = (int) (percent * updates);
      if (pup > update) {
        update = pup;
        progress();
      }
    }
  }
Example #4
0
  /**
   * Stops the progress displaying. Should be called at the end of the process whose progress was
   * displayed.
   */
  public void stop() {

    percent = 1;
    progress();
  }