javax.swing.plaf.basic
public class BasicProgressBarUI extends ProgressBarUI
Modifier and Type | Class and Description |
---|---|
class |
BasicProgressBarUI.ChangeHandler
A helper class that listens for ChangeEvents
from the progressBar's model.
|
Modifier and Type | Field and Description |
---|---|
protected Rectangle |
boxRect
Holds the value of the bouncing box that is returned by
getBox(java.awt.Rectangle) . |
protected ChangeListener |
changeListener
The Listener for the model.
|
protected JProgressBar |
progressBar
The progressBar for this UI.
|
Constructor and Description |
---|
BasicProgressBarUI()
Creates a new BasicProgressBarUI object.
|
Modifier and Type | Method and Description |
---|---|
static ComponentUI |
createUI(JComponent x)
Creates a new BasicProgressBarUI for the component.
|
protected int |
getAmountFull(Insets b,
int width,
int height)
This method returns the length of the bar (from the minimum)
in pixels (or units that the Graphics object draws in) based
on the progressBar's getPercentComplete() value.
|
protected int |
getAnimationIndex()
The current animation index.
|
protected Rectangle |
getBox(Rectangle r)
This method returns the size and position of the bouncing box
for the current animation index.
|
protected int |
getCellLength()
This method returns the length of the cells.
|
protected int |
getCellSpacing()
This method returns the spacing between cells.
|
Dimension |
getMaximumSize(JComponent c)
This method returns the maximum size of the JComponent.
|
Dimension |
getMinimumSize(JComponent c)
This method returns the minimum size of the JComponent.
|
protected Dimension |
getPreferredInnerHorizontal()
This method returns the preferred size of the inner
rectangle (the bounds without the insets) if the
progressBar is horizontal.
|
protected Dimension |
getPreferredInnerVertical()
This method returns the preferred size of the inner
rectangle (the bounds without insets) if the
progressBar is vertical.
|
Dimension |
getPreferredSize(JComponent c)
This method returns the preferred size of the
given JComponent.
|
protected Color |
getSelectionBackground()
This method returns the Color that the text is shown in when the bar is
not over the text.
|
protected Color |
getSelectionForeground()
This method returns the Color that the text is shown in when the bar is
over the text.
|
protected Point |
getStringPlacement(Graphics g,
String progressString,
int x,
int y,
int width,
int height)
This method returns the point (the top left of the bounding box)
where the text should be painted.
|
protected void |
incrementAnimationIndex()
This method increments the animation index.
|
protected void |
installDefaults()
This method changes the settings for the progressBar to
the defaults provided by the current Look and Feel.
|
protected void |
installListeners()
This method registers listeners to all the
components that this UI delegate needs to listen to.
|
void |
installUI(JComponent c)
This method installs the UI for the given JComponent.
|
void |
paint(Graphics g,
JComponent c)
This method paints the progressBar.
|
protected void |
paintDeterminate(Graphics g,
JComponent c)
This method is called if the painting to be done is
for a determinate progressBar.
|
protected void |
paintIndeterminate(Graphics g,
JComponent c)
This method is called if the painting to be done is for
an indeterminate progressBar.
|
protected void |
paintString(Graphics g,
int x,
int y,
int width,
int height,
int amountFull,
Insets b)
This method paints the string for the progressBar.
|
protected void |
setAnimationIndex(int newValue)
This method sets the current animation index.
|
protected void |
setCellLength(int cellLen)
This method sets the cell length.
|
protected void |
setCellSpacing(int cellSpace)
This method sets the cell spacing.
|
protected void |
startAnimationTimer()
This method starts the animation timer.
|
protected void |
stopAnimationTimer()
This method stops the animation timer.
|
protected void |
uninstallDefaults()
The method uninstalls any defaults that were
set by the current Look and Feel.
|
protected void |
uninstallListeners()
This method unregisters listeners to all the
components that were listened to.
|
void |
uninstallUI(JComponent c)
This method removes the UI for the given JComponent.
|
contains, getAccessibleChild, getAccessibleChildrenCount, update
protected Rectangle boxRect
getBox(java.awt.Rectangle)
.protected ChangeListener changeListener
protected JProgressBar progressBar
public BasicProgressBarUI()
public static ComponentUI createUI(JComponent x)
x
- The JComponent to create the UI for.protected int getAmountFull(Insets b, int width, int height)
b
- The insets of the progressBar.width
- The width of the progressBar.height
- The height of the progressBar.protected int getAnimationIndex()
protected Rectangle getBox(Rectangle r)
r
- The bouncing box rectangle.protected int getCellLength()
protected int getCellSpacing()
public Dimension getMaximumSize(JComponent c)
getMaximumSize
in class ComponentUI
c
- The component to find a maximum size for.public Dimension getMinimumSize(JComponent c)
getMinimumSize
in class ComponentUI
c
- The component to find a minimum size for.protected Dimension getPreferredInnerHorizontal()
protected Dimension getPreferredInnerVertical()
public Dimension getPreferredSize(JComponent c)
getPreferredSize
in class ComponentUI
c
- The component to find the preferred size for.protected Color getSelectionBackground()
protected Color getSelectionForeground()
protected Point getStringPlacement(Graphics g, String progressString, int x, int y, int width, int height)
g
- The Graphics object to measure FontMetrics with.progressString
- The string to paint.x
- The x coordinate of the overall bounds box.y
- The y coordinate of the overall bounds box.width
- The width of the overall bounds box.height
- The height of the overall bounds box.protected void incrementAnimationIndex()
public void paint(Graphics g, JComponent c)
paint
in class ComponentUI
g
- The Graphics object to paint with.c
- The JComponent to paint.protected void paintDeterminate(Graphics g, JComponent c)
g
- The Graphics object to paint with.c
- The JComponent to paint.protected void paintIndeterminate(Graphics g, JComponent c)
g
- The Graphics object to paint with.c
- The JComponent to paint.protected void paintString(Graphics g, int x, int y, int width, int height, int amountFull, Insets b)
g
- The Graphics object to paint with.x
- The x coordinate of the progressBar.y
- The y coordinate of the progressBar.width
- The width of the progressBar.height
- The height of the progressBar.amountFull
- The amount of the progressBar that has its bar filled.b
- The insets of the progressBar.protected void setAnimationIndex(int newValue)
newValue
- The new animation index.protected void setCellLength(int cellLen)
cellLen
- The cell length.protected void setCellSpacing(int cellSpace)
cellSpace
- The cell spacing.protected void startAnimationTimer()
protected void stopAnimationTimer()
protected void installDefaults()
protected void uninstallDefaults()
protected void installListeners()
protected void uninstallListeners()
public void installUI(JComponent c)
installUI
in class ComponentUI
c
- The JComponent that is having this UI installed.ComponentUI.uninstallUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()
public void uninstallUI(JComponent c)
uninstallUI
in class ComponentUI
c
- The JComponent that is having this UI uninstalled.ComponentUI.installUI(javax.swing.JComponent)
,
JComponent.setUI(javax.swing.plaf.ComponentUI)
,
JComponent.updateUI()