Class ProgressDialog

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

public class ProgressDialog extends JDialog
A cancellable progress dialog.
Since:
3.1.0
Author:
Joel Uckelman
See Also:
Serialized Form
  • Field Details

  • Constructor Details

    • ProgressDialog

      public ProgressDialog(Frame parent, String title, String text)
      Creates a progress dialog.
      Parameters:
      parent - the parent frame
      title - the dialog title
      text - the text beneath the progress bar
  • Method Details

    • fireCancelledEvent

      protected void fireCancelledEvent(ActionEvent e)
    • getLabel

      public String getLabel()
      Gets the text label shown beneath the progress bar.
      Returns:
      the text label
    • setLabel

      public void setLabel(String text)
      Sets the text label shown beneath the progress bar.
      Parameters:
      text - the text label
    • isIndeterminate

      public boolean isIndeterminate()
      Gets whether the progress bar is indeterminate.
      Returns:
      whether the progress bar is indeterminate
    • setIndeterminate

      public void setIndeterminate(boolean indet)
      Sets whether the progress bar should be indeterminate.
      Parameters:
      indet - whether the progress bar should beindeterminate
    • getProgress

      public int getProgress()
      Gets the percentage displayed by the progress bar.
      Returns:
      the percentage completed
    • setProgress

      public void setProgress(int percent)
      Sets the percentage for the progress bar.
      Parameters:
      percent - the percentage completed
    • isStringPainted

      public boolean isStringPainted()
      Gets whether the progress bar contains a progress string.
      Returns:
      whether the progress bar contains a progress string
    • setStringPainted

      public void setStringPainted(boolean painted)
      Sets whether the progress bar should contain a progress string.
      Parameters:
      painted - whether the progress bar should contain a progress string
    • addActionListener

      public void addActionListener(ActionListener l)
      Adds a cancellation listener.
      Parameters:
      l - the action listener
    • removeActionListener

      public void removeActionListener(ActionListener l)
      Removes cancellation listener.
      Parameters:
      l - the action listener
    • getActionListeners

      public ActionListener[] getActionListeners()
      Gets the list of cancellation listeners.
      Returns:
      the action listeners
    • createOnEDT

      public static ProgressDialog createOnEDT(Frame parent, String title, String text)
      Creates a progress dialog on the EDT. This is a convenience method to be used when a non-EDT thread needs to create a progress dialog in order to attach listeners to it.
      Parameters:
      parent - the parent frame
      title - the dialog title
      text - the text beneath the progress bar