Class ProgressMeter

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible, RootPaneContainer, WindowConstants

public class ProgressMeter extends JFrame
A progress bar in a frame with a title and optional label. This was written to be used with JAITools demonstration programs.

The update methods setProgress(float progress) and setLabel(String label) may be called from any thread. If the calling thread is not the AWT event dispatch thread the updates will be passed to the dispatch thread.

Since:
1.0
Author:
Michael Bedward
See Also:
  • Constructor Details

    • ProgressMeter

      public ProgressMeter()
      Constructor
    • ProgressMeter

      public ProgressMeter(String title)
      Creates a new progress bar.
      Parameters:
      title - the progress bar title
    • ProgressMeter

      public ProgressMeter(String title, String labelText)
      Creates a new progress bar
      Parameters:
      title - the progress bar title
      labelText - label to display in the body of the progress bar
  • Method Details

    • setProgress

      public void setProgress(float progress)
      Updates the progress bar. It is safe to call this method from any thread.
      Parameters:
      progress - a proportion value between 0 and 1
    • setLabel

      public void setLabel(String text)
      Updates the progress label. It is safe to call this method from any thread.
      Parameters:
      text - the new label text
    • setVisible

      public void setVisible(boolean b)
      Overrides:
      setVisible in class Window