org.formaria.swing
Class ProgressBar

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by org.formaria.swing.ProgressBar
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class ProgressBar
extends javax.swing.JComponent

A progress meter that can be dynamically updated. The progress can be set to a specified value or it can be incremented as the application proceeds. The progress bar can contain a cue or feedback image and text describing the control

Copyright (c) Formaria Ltd., 2008, This software is licensed under the GNU Public License (GPL), please see license.txt for more details. If you make commercial use of this software you must purchase a commercial license from formaria.

$Revision: 1.11 $

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class javax.swing.JComponent
javax.swing.JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
protected  java.awt.Image cueImage
           
protected  java.lang.String cueImageName
           
protected  Project currentProject
          The owner project and the context in which this object operates.
protected  java.awt.Color doneClr
           
protected  int maxProgress
           
protected  int minProgress
           
protected  int numBars
           
protected  double progress
           
protected  java.awt.Color todoClr
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
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
 
Constructor Summary
ProgressBar()
          Constructor for a new ProgressMeter
 
Method Summary
 java.lang.String getCueImageName()
          Get the name of the cue image
 int getMax()
          Get the maximum allowable progress value.
 int getMin()
          Get the minimum allowable progress value.
 int getNumBars()
          Gets the number of bars in the progress bar
 int getProgress()
          Get the progress level.
 int getStepSize()
          Get the progress increment used when next is invoked
 void next()
          Increments the progress level
 void paint(java.awt.Graphics g)
          Render the progress bar.
 void previous()
          Decrements the progress level.
 void reset()
          Sets the progress state to the minimum value;
 void setBars(int value)
          Set the number of bars
 void setCue(java.lang.String value)
          Set the cue/prompt image
 void setCueImageName(java.lang.String newName)
          Set the name of the cue image
 void setMax(int newMax)
          Set the maximum allowable progress value.
 void setMin(int newMin)
          Set the minimum allowable progress value.
 void setNumBars(int nb)
          Set the number of bars shown in the progress bar.
 void setProgress(int p)
          Set the progress to a specific level.
 void setStep(int value)
          set the step size for each increment
 void setStepSize(int ns)
          Set the step size for incrementing the progress bar
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, 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, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

doneClr

protected java.awt.Color doneClr

todoClr

protected java.awt.Color todoClr

numBars

protected int numBars

progress

protected double progress

cueImage

protected java.awt.Image cueImage

minProgress

protected int minProgress

maxProgress

protected int maxProgress

cueImageName

protected java.lang.String cueImageName

currentProject

protected Project currentProject
The owner project and the context in which this object operates.

Constructor Detail

ProgressBar

public ProgressBar()
Constructor for a new ProgressMeter

Method Detail

setProgress

public void setProgress(int p)
Set the progress to a specific level.

Parameters:
p - the new level. If p is less than 0 then the progress level is set to the step size.

getProgress

public int getProgress()
Get the progress level.

Returns:
the current value

next

public void next()
Increments the progress level


previous

public void previous()
Decrements the progress level.


setNumBars

public void setNumBars(int nb)
Set the number of bars shown in the progress bar.

Parameters:
nb - the number of bars within the progress bar

setStepSize

public void setStepSize(int ns)
Set the step size for incrementing the progress bar

Parameters:
ns - the new step size

setCueImageName

public void setCueImageName(java.lang.String newName)
Set the name of the cue image

Parameters:
newName - the name of the new image

getMax

public int getMax()
Get the maximum allowable progress value. Above this value the progress counter wraps to zero.

Returns:
the max value

setMax

public void setMax(int newMax)
Set the maximum allowable progress value. Above this value the progress counter wraps to zero.

Parameters:
newMax - the new max value

getMin

public int getMin()
Get the minimum allowable progress value. Above this value the progress counter wraps to zero.

Returns:
the min value

setMin

public void setMin(int newMin)
Set the minimum allowable progress value. Above this value the progress counter wraps to zero.

Parameters:
newMin - the new min value

paint

public void paint(java.awt.Graphics g)
Render the progress bar.

Overrides:
paint in class javax.swing.JComponent
Parameters:
g - The graphics context

reset

public void reset()
Sets the progress state to the minimum value;


setCue

public void setCue(java.lang.String value)
Set the cue/prompt image

Parameters:
value - the image name

setBars

public void setBars(int value)
Set the number of bars

Parameters:
value - the number of bars

setStep

public void setStep(int value)
set the step size for each increment

Parameters:
value -

getNumBars

public int getNumBars()
Gets the number of bars in the progress bar

Returns:
the number of bars

getCueImageName

public java.lang.String getCueImageName()
Get the name of the cue image

Returns:
the image name

getStepSize

public int getStepSize()
Get the progress increment used when next is invoked

Returns:
the progress increment