APIdia Launch Partner
Top Description Inners Fields Constructors Methods
javax.swing.plaf.basic

public Class BasicProgressBarUI

extends ProgressBarUI
Class Inheritance
Known Direct Subclasses
javax.swing.plaf.metal.MetalProgressBarUI, javax.swing.plaf.synth.SynthProgressBarUI, com.sun.java.swing.plaf.motif.MotifProgressBarUI
Imports
java.awt.BasicStroke, .Color, .Component, .Dimension, .FontMetrics, .Graphics, .Graphics2D, .Insets, .Point, .Rectangle, java.awt.event.ActionEvent, .ActionListener, .HierarchyEvent, .HierarchyListener, java.awt.geom.AffineTransform, javax.swing.BoundedRangeModel, .JComponent, .JProgressBar, .LookAndFeel, .SwingUtilities, .Timer, .UIManager, javax.swing.event.ChangeEvent, .ChangeListener, javax.swing.plaf.ComponentUI, .ProgressBarUI, java.beans.PropertyChangeListener, .PropertyChangeEvent, sun.swing.DefaultLookup, .SwingUtilities2

A Basic L&F implementation of ProgressBarUI.
Authors
Michael C. Albers, Kathy Walrath

Nested and Inner Type Summary

Modifier and TypeClass and Description
private class
BasicProgressBarUI.Animator

Implements an animation thread that invokes repaint at a fixed rate.

public class
BasicProgressBarUI.ChangeHandler

This class should be treated as a "protected" inner class.

private class

Field Summary

Modifier and TypeField and Description
private static boolean
private int
animationIndex

The current state of the indeterminate animation's cycle.

private BasicProgressBarUI.Animator
protected Rectangle
boxRect

Used to hold the location and size of the bouncing box (returned by getBox) to be painted.

private int
private int
private int
protected ChangeListener
changeListener

The instance of ChangeListener.

private Rectangle
componentInnards

The component's painting area, not including the border.

private int
cycleTime

The number of milliseconds until the animation cycle repeats.

private double
delta

For bouncing-box animation, the change in position per frame.

private BasicProgressBarUI.Handler
private int
private Rectangle
nextPaintRect

The rectangle to be updated the next time the animation thread calls repaint.

private int
numFrames

The number of frames per cycle.

private Rectangle
protected JProgressBar
progressBar

The instance of JProgressBar.

private int
repaintInterval

Interval (in ms) between repaints of the indeterminate progress bar.

private Color
private Color

Constructor Summary

AccessConstructor and Description
public
BasicProgressBarUI()

Constructs a BasicProgressBarUI.

Method Summary

Modifier and TypeMethod and Description
private void
cleanUpIndeterminateValues()

Invoked by PropertyChangeHandler.

public static ComponentUI

Returns:

a new instance of BasicProgressBarUI
createUI
(JComponent
a component
x
)

Hides javax.swing.plaf.ComponentUI.createUI.

Returns a new instance of BasicProgressBarUI.

protected int

Returns:

the amount of the progress bar that should be filled
getAmountFull
(Insets
insets
b
,
int
a width
width
,
int
a height
height
)

This determines the amount of the progress bar that should be filled based on the percent done gathered from the model.

protected int

Returns:

the index of the current animation frame
getAnimationIndex
()

Gets the index of the current animation frame.

public int
getBaseline(JComponent c, int width, int height)

Overrides javax.swing.plaf.ComponentUI.getBaseline.

Returns the baseline.

public Component.BaselineResizeBehavior
getBaselineResizeBehavior(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getBaselineResizeBehavior.

Returns an enum indicating how the baseline of the component changes as the size changes.

protected Rectangle

Returns:

null if no box should be drawn; otherwise, returns the passed-in rectangle (if non-null) or a new rectangle
getBox
(Rectangle
the Rectangle instance to be modified; may be null
r
)

Stores the position and size of the bouncing box that would be painted for the current animation index in r and returns r.

protected int

Returns:

the size of the box dimension being determined; must be no larger than availableLength
getBoxLength
(int
the amount of space available for the bouncing box to move in; for a horizontal progress bar, for example, this should be the inside width of the progress bar (the component width minus borders)
availableLength
,
int
for a horizontal progress bar, this should be the inside height of the progress bar; this value might be used to constrain or determine the return value
otherDimension
)

Returns the length of the "bouncing box" to be painted.

private int
protected int

Returns:

the value representing the spacing between cells
getCellLength
()

Returns the width (if HORIZONTAL) or height (if VERTICAL) of each of the individual cells/units to be rendered in the progress bar.

protected int

Returns:

the value representing the spacing between cells
getCellSpacing
()

Returns the spacing between each of the cells/units in the progress bar.

private int

Returns:

the cycle time, in milliseconds
getCycleTime
()

Returns the number of milliseconds per animation cycle.

protected final int

Returns:

the number of frames
getFrameCount
()

Returns the number of frames for the complete animation loop used by an indeterminate JProgressBar.

private Rectangle
getGenericBox(Rectangle r)

Assumes that the component innards, max position, etc. are up-to-date.

private BasicProgressBarUI.Handler
public Dimension
getMaximumSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getMaximumSize.

Returns the specified component's maximum size appropriate for the look and feel.

public Dimension
getMinimumSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getMinimumSize.

The Minimum size for this component is 10.

protected Dimension

Returns:

preferred size of the horizontal JProgressBar
getPreferredInnerHorizontal
()

Returns preferred size of the horizontal JProgressBar.

protected Dimension

Returns:

preferred size of the vertical JProgressBar
getPreferredInnerVertical
()

Returns preferred size of the vertical JProgressBar.

public Dimension
getPreferredSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getPreferredSize.

Returns the specified component's preferred size appropriate for the look and feel.

private int

Returns:

the repaint interval, in milliseconds
getRepaintInterval
()

Returns the desired number of milliseconds between repaints.

protected Color

Returns:

the color of the selected background
getSelectionBackground
()

The "selectionBackground" is the color of the text when it is painted over an unfilled area of the progress bar.

protected Color

Returns:

the color of the selected foreground
getSelectionForeground
()

The "selectionForeground" is the color of the text when it is painted over a filled area of the progress bar.

protected Point

Returns:

the place where the progress string will be painted
getStringPlacement
(Graphics
an instance of Graphics
g
,
String
a text
progressString
,
int
an X coordinate
x
,
int
an Y coordinate
y
,
int
a width
width
,
int
a height
height
)

Designate the place where the progress string will be painted.

protected void
incrementAnimationIndex()

Sets the index of the current animation frame, to the next valid value, which results in the progress bar being repainted.

private void
private int
private void
initIndeterminateDefaults()

Initialize cycleTime, repaintInterval, numFrames, animationIndex.

private void
initIndeterminateValues()

Invoked by PropertyChangeHandler.

private int
protected void
installDefaults()

Installs default properties.

protected void
installListeners()

Registers listeners.

public void
installUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.installUI.

Configures the specified component appropriately for the look and feel.

public void
paint(Graphics g, JComponent c)

Overrides javax.swing.plaf.ComponentUI.paint.

Delegates painting to one of two methods: paintDeterminate or paintIndeterminate.

protected void
paintDeterminate(Graphics
an instance of Graphics
g
,
JComponent
a component
c
)

All purpose paint method that should do the right thing for almost all linear, determinate progress bars.

protected void
paintIndeterminate(Graphics
an instance of Graphics
g
,
JComponent
a component
c
)

All purpose paint method that should do the right thing for all linear bouncing-box progress bars.

protected void
paintString(Graphics
an instance of Graphics
g
,
int
X location of bounding box
x
,
int
Y location of bounding box
y
,
int
width of bounding box
width
,
int
height of bounding box
height
,
int
size of the fill region, either width or height depending upon orientation.
amountFull
,
Insets
Insets of the progress bar.
b
)

Paints the progress string.

private void
paintString(Graphics
Graphics used for drawing.
g
,
int
x location of bounding box
x
,
int
y location of bounding box
y
,
int
width of bounding box
width
,
int
height of bounding box
height
,
int
start location, in x or y depending on orientation, of the filled portion of the progress bar.
fillStart
,
int
size of the fill region, either width or height depending upon orientation.
amountFull
,
Insets
Insets of the progress bar.
b
)

Paints the progress string.

protected void
setAnimationIndex(int
the new animation index; no checking is performed on its value
newValue
)

Sets the index of the current animation frame to the specified value and requests that the progress bar be repainted.

private void
setCachedPercent(int cachedPercent)

protected void
setCellLength(int
a new cell length
cellLen
)

Sets the cell length.

protected void
setCellSpacing(int
a new cell spacing
cellSpace
)

Sets the cell spacing.

private boolean
protected void
startAnimationTimer()

Starts the animation thread, creating and initializing it if necessary.

protected void
stopAnimationTimer()

Stops the animation thread.

protected void
uninstallDefaults()

Unintalls default properties.

protected void
uninstallListeners()

Removes all listeners installed by this object.

public void
uninstallUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.uninstallUI.

Reverses configuration which was done on the specified component during installUI.

private void
updateSizes()

Updates delta, max position.

Field Detail

ADJUSTTIMERback to summary
private static boolean ADJUSTTIMER
animationIndexback to summary
private int animationIndex

The current state of the indeterminate animation's cycle. 0, the initial value, means paint the first frame. When the progress bar is indeterminate and showing, the default animation thread updates this variable by invoking incrementAnimationIndex() every repaintInterval milliseconds.

animatorback to summary
private BasicProgressBarUI.Animator animator
boxRectback to summary
protected Rectangle boxRect

Used to hold the location and size of the bouncing box (returned by getBox) to be painted.

Since
1.5
cachedPercentback to summary
private int cachedPercent
cellLengthback to summary
private int cellLength
cellSpacingback to summary
private int cellSpacing
changeListenerback to summary
protected ChangeListener changeListener

The instance of ChangeListener.

componentInnardsback to summary
private Rectangle componentInnards

The component's painting area, not including the border.

cycleTimeback to summary
private int cycleTime

The number of milliseconds until the animation cycle repeats. The value of this method is set (every time the progress bar changes to indeterminate mode) using the "ProgressBar.cycleTime" key in the defaults table.

deltaback to summary
private double delta

For bouncing-box animation, the change in position per frame.

handlerback to summary
private BasicProgressBarUI.Handler handler
maxPositionback to summary
private int maxPosition
nextPaintRectback to summary
private Rectangle nextPaintRect

The rectangle to be updated the next time the animation thread calls repaint. For bouncing-box animation this rect should include the union of the currently displayed box (which needs to be erased) and the box to be displayed next. This rectangle's values are set in the setAnimationIndex method.

numFramesback to summary
private int numFrames

The number of frames per cycle. Under the default implementation, this depends on the cycleTime and repaintInterval. It must be an even number for the default painting algorithm. This value is set in the initIndeterminateValues method.

oldComponentInnardsback to summary
private Rectangle oldComponentInnards
progressBarback to summary
protected JProgressBar progressBar

The instance of JProgressBar.

repaintIntervalback to summary
private int repaintInterval

Interval (in ms) between repaints of the indeterminate progress bar. The value of this method is set (every time the progress bar changes to indeterminate mode) using the "ProgressBar.repaintInterval" key in the defaults table.

selectionBackgroundback to summary
private Color selectionBackground
selectionForegroundback to summary
private Color selectionForeground

Constructor Detail

BasicProgressBarUIback to summary
public BasicProgressBarUI()

Constructs a BasicProgressBarUI.

Method Detail

cleanUpIndeterminateValuesback to summary
private void cleanUpIndeterminateValues()

Invoked by PropertyChangeHandler.

createUIback to summary
public static ComponentUI createUI(JComponent x)

Hides javax.swing.plaf.ComponentUI.createUI.

Returns a new instance of BasicProgressBarUI.

Parameters
x:JComponent

a component

Returns:ComponentUI

a new instance of BasicProgressBarUI

getAmountFullback to summary
protected int getAmountFull(Insets b, int width, int height)

This determines the amount of the progress bar that should be filled based on the percent done gathered from the model. This is a common operation so it was abstracted out. It assumes that your progress bar is linear. That is, if you are making a circular progress indicator, you will want to override this method.

Parameters
b:Insets

insets

width:int

a width

height:int

a height

Returns:int

the amount of the progress bar that should be filled

getAnimationIndexback to summary
protected int getAnimationIndex()

Gets the index of the current animation frame.

Returns:int

the index of the current animation frame

Since
1.4
getBaselineback to summary
public int getBaseline(JComponent c, int width, int height)

Overrides javax.swing.plaf.ComponentUI.getBaseline.

Returns the baseline.

Exceptions
NullPointerException:
if c is null
IllegalArgumentException:
if width or height is < 0
Since
1.6
See Also
javax.swing.JComponent#getBaseline(int, int)
getBaselineResizeBehaviorback to summary
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getBaselineResizeBehavior.

Returns an enum indicating how the baseline of the component changes as the size changes.

Exceptions
NullPointerException:
if c is null
Since
1.6
See Also
javax.swing.JComponent#getBaseline(int, int)
getBoxback to summary
protected Rectangle getBox(Rectangle r)

Stores the position and size of the bouncing box that would be painted for the current animation index in r and returns r. Subclasses that add to the painting performed in this class's implementation of paintIndeterminate -- to draw an outline around the bouncing box, for example -- can use this method to get the location of the bouncing box that was just painted. By overriding this method, you have complete control over the size and position of the bouncing box, without having to reimplement paintIndeterminate.

Parameters
r:Rectangle

the Rectangle instance to be modified; may be null

Returns:Rectangle

null if no box should be drawn; otherwise, returns the passed-in rectangle (if non-null) or a new rectangle

Since
1.4
See Also
setAnimationIndex
getBoxLengthback to summary
protected int getBoxLength(int availableLength, int otherDimension)

Returns the length of the "bouncing box" to be painted. This method is invoked by the default implementation of paintIndeterminate to get the width (if the progress bar is horizontal) or height (if vertical) of the box. For example:

boxRect.width = getBoxLength(componentInnards.width,
                             componentInnards.height);
 
Parameters
availableLength:int

the amount of space available for the bouncing box to move in; for a horizontal progress bar, for example, this should be the inside width of the progress bar (the component width minus borders)

otherDimension:int

for a horizontal progress bar, this should be the inside height of the progress bar; this value might be used to constrain or determine the return value

Returns:int

the size of the box dimension being determined; must be no larger than availableLength

Since
1.5
See Also
javax.swing.SwingUtilities#calculateInnerArea
getCachedPercentback to summary
private int getCachedPercent()
getCellLengthback to summary
protected int getCellLength()

Returns the width (if HORIZONTAL) or height (if VERTICAL) of each of the individual cells/units to be rendered in the progress bar. However, for text rendering simplification and aesthetic considerations, this function will return 1 when the progress string is being rendered.

Returns:int

the value representing the spacing between cells

See Also
setCellLength, JProgressBar#isStringPainted
getCellSpacingback to summary
protected int getCellSpacing()

Returns the spacing between each of the cells/units in the progress bar. However, for text rendering simplification and aesthetic considerations, this function will return 0 when the progress string is being rendered.

Returns:int

the value representing the spacing between cells

See Also
setCellSpacing, JProgressBar#isStringPainted
getCycleTimeback to summary
private int getCycleTime()

Returns the number of milliseconds per animation cycle. This value is meaningful only if the progress bar is in indeterminate mode. The cycle time is used by the default indeterminate progress bar painting code when determining how far to move the bouncing box per frame. The cycle time is specified by the "ProgressBar.cycleTime" UI default and adjusted, if necessary, by the initIndeterminateDefaults method.

Returns:int

the cycle time, in milliseconds

getFrameCountback to summary
protected final int getFrameCount()

Returns the number of frames for the complete animation loop used by an indeterminate JProgressBar. The progress chunk will go from one end to the other and back during the entire loop. This visual behavior may be changed by subclasses in other Look and Feels.

Returns:int

the number of frames

Since
1.6
getGenericBoxback to summary
private Rectangle getGenericBox(Rectangle r)

Assumes that the component innards, max position, etc. are up-to-date.

getHandlerback to summary
private BasicProgressBarUI.Handler getHandler()
getMaximumSizeback to summary
public Dimension getMaximumSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getMaximumSize.

Doc from javax.swing.plaf.ComponentUI.getMaximumSize.

Returns the specified component's maximum size appropriate for the look and feel. If null is returned, the maximum size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method invokes getPreferredSize and returns that value.

getMinimumSizeback to summary
public Dimension getMinimumSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getMinimumSize.

The Minimum size for this component is 10. The rationale here is that there should be at least one pixel per 10 percent.

getPreferredInnerHorizontalback to summary
protected Dimension getPreferredInnerHorizontal()

Returns preferred size of the horizontal JProgressBar.

Returns:Dimension

preferred size of the horizontal JProgressBar

getPreferredInnerVerticalback to summary
protected Dimension getPreferredInnerVertical()

Returns preferred size of the vertical JProgressBar.

Returns:Dimension

preferred size of the vertical JProgressBar

getPreferredSizeback to summary
public Dimension getPreferredSize(JComponent c)

Overrides javax.swing.plaf.ComponentUI.getPreferredSize.

Doc from javax.swing.plaf.ComponentUI.getPreferredSize.

Returns the specified component's preferred size appropriate for the look and feel. If null is returned, the preferred size will be calculated by the component's layout manager instead (this is the preferred approach for any component with a specific layout manager installed). The default implementation of this method returns null.

getRepaintIntervalback to summary
private int getRepaintInterval()

Returns the desired number of milliseconds between repaints. This value is meaningful only if the progress bar is in indeterminate mode. The repaint interval determines how often the default animation thread's timer is fired. It's also used by the default indeterminate progress bar painting code when determining how far to move the bouncing box per frame. The repaint interval is specified by the "ProgressBar.repaintInterval" UI default.

Returns:int

the repaint interval, in milliseconds

getSelectionBackgroundback to summary
protected Color getSelectionBackground()

The "selectionBackground" is the color of the text when it is painted over an unfilled area of the progress bar.

Returns:Color

the color of the selected background

getSelectionForegroundback to summary
protected Color getSelectionForeground()

The "selectionForeground" is the color of the text when it is painted over a filled area of the progress bar.

Returns:Color

the color of the selected foreground

getStringPlacementback to summary
protected Point getStringPlacement(Graphics g, String progressString, int x, int y, int width, int height)

Designate the place where the progress string will be painted. This implementation places it at the center of the progress bar (in both x and y). Override this if you want to right, left, top, or bottom align the progress string or if you need to nudge it around for any reason.

Parameters
g:Graphics

an instance of Graphics

progressString:String

a text

x:int

an X coordinate

y:int

an Y coordinate

width:int

a width

height:int

a height

Returns:Point

the place where the progress string will be painted

incrementAnimationIndexback to summary
protected void incrementAnimationIndex()

Sets the index of the current animation frame, to the next valid value, which results in the progress bar being repainted. The next valid value is, by default, the current animation index plus one. If the new value would be too large, this method sets the index to 0. Subclasses might need to override this method to ensure that the index does not go over the number of frames needed for the particular progress bar instance. This method is invoked by the default animation thread every X milliseconds, where X is specified by the "ProgressBar.repaintInterval" UI default.

Since
1.4
See Also
setAnimationIndex
initAnimationIndexback to summary
private void initAnimationIndex()
initCycleTimeback to summary
private int initCycleTime()
initIndeterminateDefaultsback to summary
private void initIndeterminateDefaults()

Initialize cycleTime, repaintInterval, numFrames, animationIndex.

initIndeterminateValuesback to summary
private void initIndeterminateValues()

Invoked by PropertyChangeHandler.

Note

This might not be invoked until after the first paintIndeterminate call.

initRepaintIntervalback to summary
private int initRepaintInterval()
installDefaultsback to summary
protected void installDefaults()

Installs default properties.

installListenersback to summary
protected void installListeners()

Registers listeners.

installUIback to summary
public void installUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.installUI.

Doc from javax.swing.plaf.ComponentUI.installUI.

Configures the specified component appropriately for the look and feel. This method is invoked when the ComponentUI instance is being installed as the UI delegate on the specified component. This method should completely configure the component for the look and feel, including the following:

  1. Install default property values for color, fonts, borders, icons, opacity, etc. on the component. Whenever possible, property values initialized by the client program should not be overridden.
  2. Install a LayoutManager on the component if necessary.
  3. Create/add any required sub-components to the component.
  4. Create/install event listeners on the component.
  5. Create/install a PropertyChangeListener on the component in order to detect and respond to component property changes appropriately.
  6. Install keyboard UI (mnemonics, traversal, etc.) on the component.
  7. Initialize any appropriate instance data.
paintback to summary
public void paint(Graphics g, JComponent c)

Overrides javax.swing.plaf.ComponentUI.paint.

Delegates painting to one of two methods: paintDeterminate or paintIndeterminate.

paintDeterminateback to summary
protected void paintDeterminate(Graphics g, JComponent c)

All purpose paint method that should do the right thing for almost all linear, determinate progress bars. By setting a few values in the defaults table, things should work just fine to paint your progress bar. Naturally, override this if you are making a circular or semi-circular progress bar.

Parameters
g:Graphics

an instance of Graphics

c:JComponent

a component

Since
1.4
See Also
paintIndeterminate
paintIndeterminateback to summary
protected void paintIndeterminate(Graphics g, JComponent c)

All purpose paint method that should do the right thing for all linear bouncing-box progress bars. Override this if you are making another kind of progress bar.

Parameters
g:Graphics

an instance of Graphics

c:JComponent

a component

Since
1.4
See Also
paintDeterminate
paintStringback to summary
protected void paintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b)

Paints the progress string.

Parameters
g:Graphics

an instance of Graphics

x:int

X location of bounding box

y:int

Y location of bounding box

width:int

width of bounding box

height:int

height of bounding box

amountFull:int

size of the fill region, either width or height depending upon orientation.

b:Insets

Insets of the progress bar.

paintStringback to summary
private void paintString(Graphics g, int x, int y, int width, int height, int fillStart, int amountFull, Insets b)

Paints the progress string.

Parameters
g:Graphics

Graphics used for drawing.

x:int

x location of bounding box

y:int

y location of bounding box

width:int

width of bounding box

height:int

height of bounding box

fillStart:int

start location, in x or y depending on orientation, of the filled portion of the progress bar.

amountFull:int

size of the fill region, either width or height depending upon orientation.

b:Insets

Insets of the progress bar.

setAnimationIndexback to summary
protected void setAnimationIndex(int newValue)

Sets the index of the current animation frame to the specified value and requests that the progress bar be repainted. Subclasses that don't use the default painting code might need to override this method to change the way that the repaint method is invoked.

Parameters
newValue:int

the new animation index; no checking is performed on its value

Since
1.4
See Also
incrementAnimationIndex
setCachedPercentback to summary
private void setCachedPercent(int cachedPercent)
setCellLengthback to summary
protected void setCellLength(int cellLen)

Sets the cell length.

Parameters
cellLen:int

a new cell length

setCellSpacingback to summary
protected void setCellSpacing(int cellSpace)

Sets the cell spacing.

Parameters
cellSpace:int

a new cell spacing

sizeChangedback to summary
private boolean sizeChanged()
startAnimationTimerback to summary
protected void startAnimationTimer()

Starts the animation thread, creating and initializing it if necessary. This method is invoked when an indeterminate progress bar should start animating. Reasons for this may include:

  • The progress bar is determinate and becomes displayable
  • The progress bar is displayable and becomes determinate
  • The progress bar is displayable and determinate and this UI is installed
If you implement your own animation thread, you must override this method.
Since
1.4
See Also
stopAnimationTimer
stopAnimationTimerback to summary
protected void stopAnimationTimer()

Stops the animation thread. This method is invoked when the indeterminate animation should be stopped. Reasons for this may include:

  • The progress bar changes to determinate
  • The progress bar is no longer part of a displayable hierarchy
  • This UI in uninstalled
If you implement your own animation thread, you must override this method.
Since
1.4
See Also
startAnimationTimer
uninstallDefaultsback to summary
protected void uninstallDefaults()

Unintalls default properties.

uninstallListenersback to summary
protected void uninstallListeners()

Removes all listeners installed by this object.

uninstallUIback to summary
public void uninstallUI(JComponent c)

Overrides javax.swing.plaf.ComponentUI.uninstallUI.

Doc from javax.swing.plaf.ComponentUI.uninstallUI.

Reverses configuration which was done on the specified component during installUI. This method is invoked when this UIComponent instance is being removed as the UI delegate for the specified component. This method should undo the configuration performed in installUI, being careful to leave the JComponent instance in a clean state (no extraneous listeners, look-and-feel-specific property objects, etc.). This should include the following:

  1. Remove any UI-set borders from the component.
  2. Remove any UI-set layout managers on the component.
  3. Remove any UI-added sub-components from the component.
  4. Remove any UI-added event/property listeners from the component.
  5. Remove any UI-installed keyboard UI from the component.
  6. Nullify any allocated instance data objects to allow for GC.
updateSizesback to summary
private void updateSizes()

Updates delta, max position. Assumes componentInnards is correct (e.g. call after sizeChanged()).

javax.swing.plaf.basic back to summary

private Class BasicProgressBarUI.Animator

extends Object
implements ActionListener
Class Inheritance
All Implemented Interfaces
java.awt.event.ActionListener, java.util.EventListener

Implements an animation thread that invokes repaint at a fixed rate. If ADJUSTTIMER is true, this thread will continuously adjust the repaint interval to try to make the actual time between repaints match the requested rate.

Field Summary

Modifier and TypeField and Description
private long
private static final int
private long
private Timer

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
actionPerformed(ActionEvent e)

Implements java.awt.event.ActionListener.actionPerformed.

Reacts to the timer's action events.

private void
start(int interval)

Creates a timer if one doesn't already exist, then starts the timer thread.

private void
stop()

Stops the timer thread.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lastCallback to summary
private long lastCall
MINIMUM_DELAYback to summary
private static final int MINIMUM_DELAY
previousDelayback to summary
private long previousDelay
timerback to summary
private Timer timer

Constructor Detail

Animatorback to summary
private Animator()

Method Detail

actionPerformedback to summary
public void actionPerformed(ActionEvent e)

Implements java.awt.event.ActionListener.actionPerformed.

Reacts to the timer's action events.

startback to summary
private void start(int interval)

Creates a timer if one doesn't already exist, then starts the timer thread.

stopback to summary
private void stop()

Stops the timer thread.

javax.swing.plaf.basic back to summary

public Class BasicProgressBarUI.ChangeHandler

extends Object
implements ChangeListener
Class Inheritance
All Implemented Interfaces
javax.swing.event.ChangeListener, java.util.EventListener

This class should be treated as a "protected" inner class. Instantiate it only within subclasses of BasicProgressBarUI.

Constructor Summary

AccessConstructor and Description
public
ChangeHandler()

Constructs a ChangeHandler.

Method Summary

Modifier and TypeMethod and Description
public void
stateChanged(ChangeEvent e)

Implements javax.swing.event.ChangeListener.stateChanged.

Invoked when the target of the listener has changed its state.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

ChangeHandlerback to summary
public ChangeHandler()

Constructs a ChangeHandler.

Method Detail

stateChangedback to summary
public void stateChanged(ChangeEvent e)

Implements javax.swing.event.ChangeListener.stateChanged.

Doc from javax.swing.event.ChangeListener.stateChanged.

Invoked when the target of the listener has changed its state.

javax.swing.plaf.basic back to summary

private Class BasicProgressBarUI.Handler

extends Object
implements ChangeListener, PropertyChangeListener, HierarchyListener
Class Inheritance
All Implemented Interfaces
java.awt.event.HierarchyListener, java.util.EventListener, java.beans.PropertyChangeListener, javax.swing.event.ChangeListener

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public void
hierarchyChanged(HierarchyEvent he)

Implements java.awt.event.HierarchyListener.hierarchyChanged.

Called when the hierarchy has been changed.

public void
propertyChange(PropertyChangeEvent e)

Implements java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

public void
stateChanged(ChangeEvent e)

Implements javax.swing.event.ChangeListener.stateChanged.

Invoked when the target of the listener has changed its state.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

Handlerback to summary
private Handler()

Method Detail

hierarchyChangedback to summary
public void hierarchyChanged(HierarchyEvent he)

Implements java.awt.event.HierarchyListener.hierarchyChanged.

Doc from java.awt.event.HierarchyListener.hierarchyChanged.

Called when the hierarchy has been changed. To discern the actual type of change, call HierarchyEvent.getChangeFlags().

propertyChangeback to summary
public void propertyChange(PropertyChangeEvent e)

Implements java.beans.PropertyChangeListener.propertyChange.

Doc from java.beans.PropertyChangeListener.propertyChange.

This method gets called when a bound property is changed.

stateChangedback to summary
public void stateChanged(ChangeEvent e)

Implements javax.swing.event.ChangeListener.stateChanged.

Doc from javax.swing.event.ChangeListener.stateChanged.

Invoked when the target of the listener has changed its state.