| Modifier and Type | Class and Description |
|---|---|
| private class | BasicProgressBarUI.
Implements an animation thread that invokes repaint at a fixed rate. |
| public class | BasicProgressBarUI.
This class should be treated as a "protected" inner class. |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private static boolean | |
| private int | animationIndex
The current state of the indeterminate animation's cycle. |
| private BasicProgressBarUI. | |
| 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 |
| 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. | |
| 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 |
| private int | repaintInterval
Interval (in ms) between repaints of the indeterminate progress bar. |
| private Color | |
| private Color |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private void | |
| public static ComponentUI | Returns: a new instance ofBasicProgressBarUIa component x)Hides javax. Returns a new instance of |
| protected int | Returns: the amount of the progress bar that should be filledinsets 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 frameGets the index of the current animation frame. |
| public int | getBaseline(JComponent c, int width, int height)
Overrides javax. Returns the baseline. |
| public Component. | getBaselineResizeBehavior(JComponent c)
Overrides javax. 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 rectanglethe Rectangle instance to be modified;
may be r)nullStores the position and size of
the bouncing box that would be painted for the current animation index
in |
| protected int | Returns: the size of the box dimension being determined; must be no larger thanavailableLengththe 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 cellsReturns 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 cellsReturns the spacing between each of the cells/units in the progress bar. |
| private int | Returns: the cycle time, in millisecondsReturns the number of milliseconds per animation cycle. |
| protected final int | Returns: the number of framesReturns the number of frames for the complete animation loop used by an indeterminate JProgressBar. |
| private Rectangle | |
| private BasicProgressBarUI. | |
| public Dimension | getMaximumSize(JComponent c)
Overrides javax. Returns the specified component's maximum size appropriate for the look and feel. |
| public Dimension | getMinimumSize(JComponent c)
Overrides javax. The Minimum size for this component is 10. |
| protected Dimension | Returns: preferred size of the horizontalJProgressBarReturns preferred size of the horizontal |
| protected Dimension | Returns: preferred size of the verticalJProgressBarReturns preferred size of the vertical |
| public Dimension | getPreferredSize(JComponent c)
Overrides javax. Returns the specified component's preferred size appropriate for the look and feel. |
| private int | Returns: the repaint interval, in millisecondsReturns the desired number of milliseconds between repaints. |
| protected Color | Returns: the color of the selected backgroundThe "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 foregroundThe "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 paintedan instance of g, String Graphicsa 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 | |
| private void | |
| private int | |
| protected void | |
| protected void | |
| public void | installUI(JComponent c)
Overrides javax. Configures the specified component appropriately for the look and feel. |
| public void | paint(Graphics g, JComponent c)
Overrides javax. Delegates painting to one of two methods: paintDeterminate or paintIndeterminate. |
| protected void | paintDeterminate(Graphics
an instance of g, JComponent Graphicsa 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 g, JComponent Graphicsa 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 g, int GraphicsX 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 | |
| protected void | |
| protected void | |
| private boolean | |
| protected void | |
| protected void | |
| protected void | |
| protected void | |
| public void | uninstallUI(JComponent c)
Overrides javax. Reverses configuration which was done on the specified component during
|
| private void |
| ADJUSTTIMER | back to summary |
|---|---|
| private static boolean ADJUSTTIMER | |
| animationIndex | back 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. | |
| animator | back to summary |
|---|---|
| private BasicProgressBarUI. | |
| boxRect | back to summary |
|---|---|
| protected Rectangle boxRect Used to hold the location and size of the bouncing box (returned by getBox) to be painted.
| |
| cachedPercent | back to summary |
|---|---|
| private int cachedPercent | |
| cellLength | back to summary |
|---|---|
| private int cellLength | |
| cellSpacing | back to summary |
|---|---|
| private int cellSpacing | |
| changeListener | back to summary |
|---|---|
| protected ChangeListener changeListener The instance of | |
| componentInnards | back to summary |
|---|---|
| private Rectangle componentInnards The component's painting area, not including the border. | |
| cycleTime | back 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. | |
| delta | back to summary |
|---|---|
| private double delta For bouncing-box animation, the change in position per frame. | |
| handler | back to summary |
|---|---|
| private BasicProgressBarUI. | |
| maxPosition | back to summary |
|---|---|
| private int maxPosition | |
| nextPaintRect | back 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. | |
| numFrames | back 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. | |
| oldComponentInnards | back to summary |
|---|---|
| private Rectangle oldComponentInnards | |
| progressBar | back to summary |
|---|---|
| protected JProgressBar progressBar The instance of | |
| repaintInterval | back 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. | |
| selectionBackground | back to summary |
|---|---|
| private Color selectionBackground | |
| selectionForeground | back to summary |
|---|---|
| private Color selectionForeground | |
| BasicProgressBarUI | back to summary |
|---|---|
| public BasicProgressBarUI() Constructs a | |
| cleanUpIndeterminateValues | back to summary |
|---|---|
| private void cleanUpIndeterminateValues() Invoked by PropertyChangeHandler. | |
| createUI | back to summary |
|---|---|
| public static ComponentUI createUI(JComponent x) Hides javax. Returns a new instance of
| |
| getAmountFull | back 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.
| |
| getAnimationIndex | back to summary |
|---|---|
| protected int getAnimationIndex() Gets the index of the current animation frame.
| |
| getBaseline | back to summary |
|---|---|
| public int getBaseline(JComponent c, int width, int height) Overrides javax. Returns the baseline.
| |
| getBaselineResizeBehavior | back to summary |
|---|---|
| public Component. Overrides javax. Returns an enum indicating how the baseline of the component changes as the size changes.
| |
| getBox | back 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
| |
| getBoxLength | back 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
| |
| getCachedPercent | back to summary |
|---|---|
| private int getCachedPercent() | |
| getCellLength | back 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.
| |
| getCellSpacing | back 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.
| |
| getCycleTime | back 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.
| |
| getFrameCount | back 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.
| |
| getGenericBox | back to summary |
|---|---|
| private Rectangle getGenericBox(Rectangle r) Assumes that the component innards, max position, etc. are up-to-date. | |
| getHandler | back to summary |
|---|---|
| private BasicProgressBarUI. | |
| getMaximumSize | back to summary |
|---|---|
| public Dimension getMaximumSize(JComponent c) Overrides javax. Doc from javax. Returns the specified component's maximum size appropriate for
the look and feel. If | |
| getMinimumSize | back to summary |
|---|---|
| public Dimension getMinimumSize(JComponent c) Overrides javax. The Minimum size for this component is 10. The rationale here is that there should be at least one pixel per 10 percent. | |
| getPreferredInnerHorizontal | back to summary |
|---|---|
| protected Dimension getPreferredInnerHorizontal() Returns preferred size of the horizontal
| |
| getPreferredInnerVertical | back to summary |
|---|---|
| protected Dimension getPreferredInnerVertical() Returns preferred size of the vertical
| |
| getPreferredSize | back to summary |
|---|---|
| public Dimension getPreferredSize(JComponent c) Overrides javax. Doc from javax. Returns the specified component's preferred size appropriate for
the look and feel. If | |
| getRepaintInterval | back 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.
| |
| getSelectionBackground | back 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.
| |
| getSelectionForeground | back 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.
| |
| getStringPlacement | back 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. | |
| incrementAnimationIndex | back 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.
| |
| initAnimationIndex | back to summary |
|---|---|
| private void initAnimationIndex() | |
| initCycleTime | back to summary |
|---|---|
| private int initCycleTime() | |
| initIndeterminateDefaults | back to summary |
|---|---|
| private void initIndeterminateDefaults() Initialize cycleTime, repaintInterval, numFrames, animationIndex. | |
| initIndeterminateValues | back to summary |
|---|---|
| private void initIndeterminateValues() Invoked by PropertyChangeHandler. Note This might not be invoked until after the first paintIndeterminate call. | |
| initRepaintInterval | back to summary |
|---|---|
| private int initRepaintInterval() | |
| installDefaults | back to summary |
|---|---|
| protected void installDefaults() Installs default properties. | |
| installListeners | back to summary |
|---|---|
| protected void installListeners() Registers listeners. | |
| installUI | back to summary |
|---|---|
| public void installUI(JComponent c) Overrides javax. Doc from javax. Configures the specified component appropriately for the look and feel.
This method is invoked when the
| |
| paint | back to summary |
|---|---|
| public void paint(Graphics g, JComponent c) Overrides javax. Delegates painting to one of two methods: paintDeterminate or paintIndeterminate. | |
| paintDeterminate | back 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.
| |
| paintIndeterminate | back 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.
| |
| paintString | back to summary |
|---|---|
| protected void paintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b) Paints the progress string. | |
| paintString | back 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.
| |
| setAnimationIndex | back 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
| |
| setCachedPercent | back to summary |
|---|---|
| private void setCachedPercent(int cachedPercent) | |
| setCellLength | back to summary |
|---|---|
| protected void setCellLength(int cellLen) Sets the cell length.
| |
| setCellSpacing | back to summary |
|---|---|
| protected void setCellSpacing(int cellSpace) Sets the cell spacing.
| |
| sizeChanged | back to summary |
|---|---|
| private boolean sizeChanged() | |
| startAnimationTimer | back 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:
| |
| stopAnimationTimer | back 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:
| |
| uninstallDefaults | back to summary |
|---|---|
| protected void uninstallDefaults() Unintalls default properties. | |
| uninstallListeners | back to summary |
|---|---|
| protected void uninstallListeners() Removes all listeners installed by this object. | |
| uninstallUI | back to summary |
|---|---|
| public void uninstallUI(JComponent c) Overrides javax. Doc from javax. Reverses configuration which was done on the specified component during
| |
| updateSizes | back to summary |
|---|---|
| private void updateSizes() Updates delta, max position. Assumes componentInnards is correct (e.g. call after sizeChanged()). | |
| Modifier and Type | Field and Description |
|---|---|
| private long | |
| private static final int | |
| private long | |
| private Timer |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | actionPerformed(ActionEvent e)
Implements java. Reacts to the timer's action events. |
| private void | |
| private void |
| lastCall | back to summary |
|---|---|
| private long lastCall | |
| MINIMUM_DELAY | back to summary |
|---|---|
| private static final int MINIMUM_DELAY | |
| previousDelay | back to summary |
|---|---|
| private long previousDelay | |
| timer | back to summary |
|---|---|
| private Timer timer | |
| Animator | back to summary |
|---|---|
| private Animator() | |
| actionPerformed | back to summary |
|---|---|
| public void actionPerformed(ActionEvent e) Implements java. Reacts to the timer's action events. | |
| start | back to summary |
|---|---|
| private void start(int interval) Creates a timer if one doesn't already exist, then starts the timer thread. | |
| stop | back to summary |
|---|---|
| private void stop() Stops the timer thread. | |
BasicProgressBarUI.
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | stateChanged(ChangeEvent e)
Implements javax. Invoked when the target of the listener has changed its state. |
| ChangeHandler | back to summary |
|---|---|
| public ChangeHandler() Constructs a | |
| stateChanged | back to summary |
|---|---|
| public void stateChanged(ChangeEvent e) Implements javax. Doc from javax. Invoked when the target of the listener has changed its state. | |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public void | hierarchyChanged(HierarchyEvent he)
Implements java. Called when the hierarchy has been changed. |
| public void | propertyChange(PropertyChangeEvent e)
Implements java. This method gets called when a bound property is changed. |
| public void | stateChanged(ChangeEvent e)
Implements javax. Invoked when the target of the listener has changed its state. |
| Handler | back to summary |
|---|---|
| private Handler() | |
| hierarchyChanged | back to summary |
|---|---|
| public void hierarchyChanged(HierarchyEvent he) Implements java. Doc from java. Called when the hierarchy has been changed. To discern the actual
type of change, call | |
| propertyChange | back to summary |
|---|---|
| public void propertyChange(PropertyChangeEvent e) Implements java. Doc from java. This method gets called when a bound property is changed. | |
| stateChanged | back to summary |
|---|---|
| public void stateChanged(ChangeEvent e) Implements javax. Doc from javax. Invoked when the target of the listener has changed its state. | |