Class ProgressDialog
java.lang.Object
java.awt.Component
java.awt.Container
java.awt.Window
java.awt.Dialog
javax.swing.JDialog
com.compomics.util.gui.waiting.waitinghandlers.ProgressDialog
- All Implemented Interfaces:
ImageObserver
,MenuContainer
,Serializable
,Accessible
,RootPaneContainer
,WindowConstants
public class ProgressDialog extends JDialog
This class implements a modal dialog that is displayed during a longer-lasting task.
- Version:
- $Id: ProgressDialog.java,v 1.1 2009/08/02 13:23:46 lennart Exp $
- Author:
- Lennatr Martens
- See Also:
- Serialized Form
-
Nested Class Summary
Nested classes/interfaces inherited from class java.awt.Dialog
Dialog.AccessibleAWTDialog, Dialog.ModalExclusionType, Dialog.ModalityType
Nested classes/interfaces inherited from class java.awt.Window
Window.AccessibleAWTWindow, Window.Type
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Field Summary
Fields inherited from class javax.swing.JDialog
accessibleContext, rootPane, rootPaneCheckingEnabled
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Fields inherited from interface javax.swing.WindowConstants
DISPOSE_ON_CLOSE, DO_NOTHING_ON_CLOSE, EXIT_ON_CLOSE, HIDE_ON_CLOSE
-
Constructor Summary
Constructors Constructor Description ProgressDialog()
Empty default constructorProgressDialog(JFrame aParent, String aTitle, String aMessage)
Deprecated.use ProgressDialogX instead -
Method Summary
Modifier and Type Method Description int
getMaximumValue()
Returns the current maximum value for the progressbar.int
getMinimumValue()
Returns the current minimum value for the progressbar.int
getProgress()
This method reports on the current progress of the progressdialog.boolean
isIndeterminate()
This method signals whether the progressdialog is currently in indeterminate ('true') or determinate ('false') mode.boolean
isProgressBarValid()
This method reports on whether this instance can be controlled in a multithreaded environment.void
setDeterminate(int aMin, int aMax)
This method sets the progressbar to determinate mode, with the specified minimum and maximum values.void
setIndeterminate()
This method makes the progressbar indeterminate.void
setMessage(String aMessage)
This method allows the caller to set a message on the progressbar.void
setProgress(int aValue)
This method sets the progress to the specified value.void
setProgress(int aValue, String aMessage)
This method allows the caller to set the progress on the progressbar to the specified value, along with the specified message.Methods inherited from class javax.swing.JDialog
addImpl, createRootPane, dialogInit, getAccessibleContext, getContentPane, getDefaultCloseOperation, getGlassPane, getGraphics, getJMenuBar, getLayeredPane, getRootPane, getTransferHandler, isDefaultLookAndFeelDecorated, isRootPaneCheckingEnabled, paramString, processWindowEvent, remove, repaint, setContentPane, setDefaultCloseOperation, setDefaultLookAndFeelDecorated, setGlassPane, setJMenuBar, setLayeredPane, setLayout, setRootPane, setRootPaneCheckingEnabled, setTransferHandler, update
Methods inherited from class java.awt.Dialog
addNotify, getModalityType, getTitle, hide, isModal, isResizable, isUndecorated, setBackground, setModal, setModalityType, setOpacity, setResizable, setShape, setTitle, setUndecorated, setVisible, show, toBack
Methods inherited from class java.awt.Window
addPropertyChangeListener, addPropertyChangeListener, addWindowFocusListener, addWindowListener, addWindowStateListener, applyResourceBundle, applyResourceBundle, createBufferStrategy, createBufferStrategy, dispose, getBackground, getBufferStrategy, getFocusableWindowState, getFocusCycleRootAncestor, getFocusOwner, getFocusTraversalKeys, getIconImages, getInputContext, getListeners, getLocale, getModalExclusionType, getMostRecentFocusOwner, getOpacity, getOwnedWindows, getOwner, getOwnerlessWindows, getShape, getToolkit, getType, getWarningString, getWindowFocusListeners, getWindowListeners, getWindows, getWindowStateListeners, isActive, isAlwaysOnTop, isAlwaysOnTopSupported, isAutoRequestFocus, isFocusableWindow, isFocusCycleRoot, isFocused, isLocationByPlatform, isOpaque, isShowing, isValidateRoot, pack, paint, postEvent, processEvent, processWindowFocusEvent, processWindowStateEvent, removeNotify, removeWindowFocusListener, removeWindowListener, removeWindowStateListener, reshape, setAlwaysOnTop, setAutoRequestFocus, setBounds, setBounds, setCursor, setFocusableWindowState, setFocusCycleRoot, setIconImage, setIconImages, setLocation, setLocation, setLocationByPlatform, setLocationRelativeTo, setMinimumSize, setModalExclusionType, setSize, setSize, setType, toFront
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalPolicy, getInsets, getLayout, getMaximumSize, getMinimumSize, getMousePosition, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, processContainerEvent, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, transferFocusDownCycle, validate, validateTree
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, prepareImage, prepareImage, printAll, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, requestFocusInWindow, resize, resize, revalidate, setComponentOrientation, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setMaximumSize, setMixingCutoutShape, setName, setPreferredSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Constructor Details
-
ProgressDialog
public ProgressDialog()Empty default constructor -
ProgressDialog
Deprecated.use ProgressDialogX insteadCreates an indeterminate ProgressDialog by default, with the specified title and message. The methods 'setDeterminate()' and 'setIndeterminate()' allow the caller to set the type of progressbar. A determinate progressbar can report meaningfully on the progress.- Parameters:
aParent
- aParent to link this dialog to.aTitle
- String with the title for this dialog.aMessage
- String with the message to display, can be 'null' for no message.
-
-
Method Details
-
setIndeterminate
public void setIndeterminate()This method makes the progressbar indeterminate. -
setDeterminate
public void setDeterminate(int aMin, int aMax)This method sets the progressbar to determinate mode, with the specified minimum and maximum values. It will also set the current value to the minimum.- Parameters:
aMin
- int with the minimal value for the progress.aMax
- int with the maximal value for the progress.
-
getMaximumValue
public int getMaximumValue()Returns the current maximum value for the progressbar. Only returns sensible information if the progressdialog is in determinate mode.- Returns:
- int with the maximum value for the progressbar.
-
getMinimumValue
public int getMinimumValue()Returns the current minimum value for the progressbar. Only returns sensible information if the progressdialog is in determinate mode.- Returns:
- int with the minimum value for the progressbar.
-
isIndeterminate
public boolean isIndeterminate()This method signals whether the progressdialog is currently in indeterminate ('true') or determinate ('false') mode.- Returns:
- boolean that indicates whether the progressdialog is currently in indeterminate ('true') or determinate ('false') mode.
-
setProgress
This method allows the caller to set the progress on the progressbar to the specified value, along with the specified message. The message can be 'null' for no message. Note that setting the progressbar to maximum value does not automatically make the progressdialog invisible - this task is left to the user of this component!- Parameters:
aValue
- int with the value to set the progress to. Will throw IllegalArgumentException if this value is out of bounds (less than 'getMinimumValue()' or more than 'getMaximumValue()'. Note that setting the progressbar to maximum value does not automatically make the progressdialog invisible - this task is left to the user of this component!aMessage
- String with the message to set on the progressbar, or 'null' for no message.
-
setMessage
This method allows the caller to set a message on the progressbar. Specify a 'null' to remove any messages.- Parameters:
aMessage
- String with message, or 'null' to remove any message.
-
isProgressBarValid
public boolean isProgressBarValid()This method reports on whether this instance can be controlled in a multithreaded environment. While this method returns 'false', it is dangerous to alter any settings on this porgressdialog, as the component is not fully drawn and initialized yet!- Returns:
- boolean that indicates whether it is safe ('true') or not ('false') for callers to interact with this progressdialog.
-
setProgress
public void setProgress(int aValue)This method sets the progress to the specified value. This method is only useful if the progressbar is in determinate mode. Note that setting the progressbar to maximum value does not automatically make the progressdialog invisible - this task is left to the user of this component!- Parameters:
aValue
- int with the value to set the progress to. Will throw IllegalArgumentException if this value is out of bounds (less than 'getMinimumValue()' or more than 'getMaximumValue()'. Note that setting the progressbar to maximum value does not automatically make the progressdialog invisible - this task is left to the user of this component!
-
getProgress
public int getProgress()This method reports on the current progress of the progressdialog. This method can only be relied on when the progressdialog is in determinate mode.- Returns:
- int with the current value of the progress.
-