Los Alamos National Laboratory

D  Decision Applications


  • Group Leader
    Kristin Omberg
  • Deputy Group Leader
    David Cremer
  • Office Administrator
    Lorraine Johnson
  • Group Office Location
    TA-52, Bldg. 115
    MS K551

Progress Bars

Before we started using Swing, we developed progress bars to show the user how a task was progressing. They can be used with either AWT or Swing applications. The ProgressBar class can be used when we know how much progress has been made. To use this class, create a progress bar, set the beginning and ending values, and then update the progress as the task progresses.

ProgressBar pB = new ProgressBar();
double start = 25.0; // the progress value before we begin. The task is 0% complete
double end = 76.4; // the progress value when we finish. The task is 100% complete

double progress;
As the task proceeds:
When the progress is equal to or exceeds the maximum, the progress bar goes away.

The BusyProgressBar can be used when you don’t know how much of a task has been completed. The BusyProgressBar shows a moving progress. Once the bar reaches 100 percent completion, it starts over at the beginning again. To use this class:

BusyProgressBar bPB = new BusyProgressBar(); // the repeating bar is now showing
bPB.stopBusyProgressBar(); // the repeating bar disappears. Call when the task is
// complete.

download button (java utilities.zip)

Operated by Los Alamos National Security, LLC for the U.S. Department of Energy's NNSA
Inside | © Copyright 2014 Los Alamos National Security, LLC All rights reserved | Disclaimer/Privacy | Web Contact