public class

WindowsProgressBarUI

extends BasicProgressBarUI
java.lang.Object
   ↳ javax.swing.plaf.ComponentUI
     ↳ javax.swing.plaf.ProgressBarUI
       ↳ javax.swing.plaf.basic.BasicProgressBarUI
         ↳ com.sun.java.swing.plaf.windows.WindowsProgressBarUI

Class Overview

Windows rendition of the component.

Warning: Serialized objects of this class will not be compatible with future Swing releases. The current serialization support is appropriate for short term storage or RMI between applications running the same version of Swing. A future release of Swing will provide support for long term persistence.

Summary

[Expand]
Inherited Fields
From class javax.swing.plaf.basic.BasicProgressBarUI
Public Constructors
WindowsProgressBarUI()
Public Methods
static ComponentUI createUI(JComponent x)
int getBaseline(JComponent c, int width, int height)
Returns the baseline.
Protected Methods
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.
int getBoxLength(int availableLength, int otherDimension)
Returns the length of the "bouncing box" to be painted.
Dimension getPreferredInnerHorizontal()
Dimension getPreferredInnerVertical()
void installDefaults()
void paintDeterminate(Graphics g, JComponent c)
All purpose paint method that should do the right thing for almost all linear, determinate progress bars.
void paintIndeterminate(Graphics g, JComponent c)
All purpose paint method that should do the right thing for all linear bouncing-box progress bars.
void setAnimationIndex(int newValue)
Sets the index of the current animation frame to the specified value and requests that the progress bar be repainted.
[Expand]
Inherited Methods
From class javax.swing.plaf.basic.BasicProgressBarUI
From class javax.swing.plaf.ComponentUI
From class java.lang.Object

Public Constructors

public WindowsProgressBarUI ()

Public Methods

public static ComponentUI createUI (JComponent x)

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

Returns the baseline.

Parameters
c JComponent baseline is being requested for
width the width to get the baseline for
height the height to get the baseline for
Returns
  • baseline or a value < 0 indicating there is no reasonable baseline

Protected Methods

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 the Rectangle instance to be modified; may be null
Returns
  • null if no box should be drawn; otherwise, returns the passed-in rectangle (if non-null) or a new rectangle

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 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 value
Returns
  • the size of the box dimension being determined; must be no larger than availableLength

protected Dimension getPreferredInnerHorizontal ()

protected Dimension getPreferredInnerVertical ()

protected void installDefaults ()

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.

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.

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 the new animation index; no checking is performed on its value