| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public class BasicProgressBarUI extends ProgressBarUI
A Basic L&F implementation of ProgressBarUI.
Nested Class Summary | |
---|---|
class |
This inner class is marked "public" due to a compiler bug. |
Field Summary | |
---|---|
protected Rectangle |
boxRect
Used to hold the location and size of the bouncing box (returned by getBox) to be painted. |
protected ChangeListener |
changeListener
|
protected JProgressBar |
progressBar
|
Constructor Summary | |
---|---|
|
Method Summary | |
---|---|
static ComponentUI |
|
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. |
protected int |
Gets the index of the current animation frame. |
int |
getBaseline(JComponent c, int width, int height) Returns the baseline. |
Component.BaselineResizeBehavior |
Returns an enum indicating how the baseline of the component changes as the size changes. |
protected Rectangle |
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 |
getBoxLength(int availableLength, int otherDimension) Returns the length of the "bouncing box" to be painted. |
protected int |
Returns the width (if HORIZONTAL) or height (if VERTICAL) of each of the indivdual cells/units to be rendered in the progress bar. |
protected int |
Returns the spacing between each of the cells/units in the progress bar. |
protected int |
Returns the number of frames for the complete animation loop used by an indeterminate JProgessBar. |
Dimension |
Returns the specified component's maximum size appropriate for the look and feel. |
Dimension |
The Minimum size for this component is 10. |
protected Dimension |
|
protected Dimension |
|
Dimension |
Returns the specified component's preferred size appropriate for the look and feel. |
protected Color |
The "selectionBackground" is the color of the text when it is painted over an unfilled area of the progress bar. |
protected Color |
The "selectionForeground" is the color of the text when it is painted over a filled area of the progress bar. |
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. |
protected void |
Sets the index of the current animation frame, to the next valid value, which results in the progress bar being repainted. |
protected void |
|
protected void |
|
void |
Configures the specified component appropriate for the look and feel. |
void |
paint(Graphics g, JComponent c) Delegates painting to one of two methods: paintDeterminate or paintIndeterminate. |
protected void |
All purpose paint method that should do the right thing for almost all linear, determinate progress bars. |
protected void |
All purpose paint method that should do the right thing for all linear bouncing-box progress bars. |
protected void |
paintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b) |
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. |
protected void |
setCellLength(int cellLen) |
protected void |
setCellSpacing(int cellSpace) |
protected void |
Starts the animation thread, creating and initializing it if necessary. |
protected void |
Stops the animation thread. |
protected void |
|
protected void |
Removes all listeners installed by this object. |
void |
Reverses configuration which was done on the specified component during installUI .
|
Methods inherited from class javax.swing.plaf.ComponentUI |
---|
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected Rectangle boxRect
protected ChangeListener changeListener
protected JProgressBar progressBar
Constructor Detail |
---|
public BasicProgressBarUI()
Method Detail |
---|
public static ComponentUI createUI(JComponent x)
x
protected int getAmountFull(Insets b, int width, int height)
b
width
height
protected int getAnimationIndex()
public int getBaseline(JComponent c, int width, int height)
getBaseline
in class ComponentUI
c
width
height
public Component.BaselineResizeBehavior getBaselineResizeBehavior(JComponent c)
getBaselineResizeBehavior
in class ComponentUI
c
protected Rectangle getBox(Rectangle r)
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
.
r
- the Rectangle instance to be modified;
may be null
null
if no box should be drawn;
otherwise, returns the passed-in rectangle
(if non-null)
or a new rectangleprotected int getBoxLength(int availableLength, int otherDimension)
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);
availableLength
- 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
- 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 valueavailableLength
protected int getCellLength()
protected int getCellSpacing()
protected final int getFrameCount()
public Dimension getMaximumSize(JComponent c)
getMaximumSize
in class ComponentUI
c
public Dimension getMinimumSize(JComponent c)
getMinimumSize
in class ComponentUI
c
protected Dimension getPreferredInnerHorizontal()
protected Dimension getPreferredInnerVertical()
public Dimension getPreferredSize(JComponent c)
getPreferredSize
in class ComponentUI
c
protected Color getSelectionBackground()
protected Color getSelectionForeground()
protected Point getStringPlacement(Graphics g, String progressString, int x, int y, int width, int height)
g
progressString
x
y
width
height
protected void incrementAnimationIndex()
protected void installDefaults()
protected void installListeners()
public void installUI(JComponent c)
installUI
in class ComponentUI
c
public void paint(Graphics g, JComponent c)
paint
in class ComponentUI
g
c
protected void paintDeterminate(Graphics g, JComponent c)
g
c
protected void paintIndeterminate(Graphics g, JComponent c)
g
c
protected void paintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b)
g
x
y
width
height
amountFull
b
protected void setAnimationIndex(int newValue)
repaint
method
is invoked.
newValue
- the new animation index; no checking
is performed on its valueprotected void setCellLength(int cellLen)
cellLen
protected void setCellSpacing(int cellSpace)
cellSpace
protected void startAnimationTimer()
protected void stopAnimationTimer()
protected void uninstallDefaults()
protected void uninstallListeners()
public void uninstallUI(JComponent c)
uninstallUI
in class ComponentUI
c
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |