Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Swing 1.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javax.swing.plaf.basic
Class BasicProgressBarUI

    java.lang.Object
      |
      +--javax.swing.plaf.ComponentUI
            |
            +--javax.swing.plaf.ProgressBarUI
                  |
                  +--javax.swing.plaf.basic.BasicProgressBarUI

Direct Known Subclasses:
  MetalProgressBarUI

public class BasicProgressBarUI
extends ProgressBarUI

A Basic L&F implementation of ProgressBarUI.

Inner Class Summary
`class` | `BasicProgressBarUI.ChangeHandler` This inner class is marked "public" due to a compiler bug.

Field Summary
`protected ChangeListener` | `changeListener`
`protected JProgressBar` | `progressBar`

Constructor Summary
`BasicProgressBarUI()`

Method Summary
`static ComponentUI` | `createUI(JComponent x)`
`protected int` | `getAmountFull(java.awt.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` | `getCellLength()` 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` | `getCellSpacing()` Returns the spacing between each of the cells/units in the progress bar.
`java.awt.Dimension` | `getMaximumSize(JComponent c)`
`java.awt.Dimension` | `getMinimumSize(JComponent c)` The Minimum size for this component is 10.
`protected java.awt.Dimension` | `getPreferredInnerHorizontal()`
`protected java.awt.Dimension` | `getPreferredInnerVertical()`
`java.awt.Dimension` | `getPreferredSize(JComponent c)`
`protected java.awt.Color` | `getSelectionBackground()` The "selectionBackground" is the color of the text when it is drawn over an unfilled area of the progress bar.
`protected java.awt.Color` | `getSelectionForeground()` The "selectionForeground" is the color of the text when it is drawn over a filled area of the progress bar.
`protected java.awt.Point` | `getStringPlacement(java.awt.Graphics g, java.lang.String progressString, int x, int y, int width, int height)` Designate the place where the progress string will be drawn.
`protected void` | `installDefaults()`
`protected void` | `installListeners()`
`void` | `installUI(JComponent c)`
`void` | `paint(java.awt.Graphics g, JComponent c)` All purpose paint method that should do the right thing for almost all linear progress bars.
`protected void` | `paintString(java.awt.Graphics g, int x, int y, int width, int height, int amountFull, java.awt.Insets b)`
`protected void` | `setCellLength(int cellLen)`
`protected void` | `setCellSpacing(int cellSpace)`
`protected void` | `uninstallDefaults()`
`protected void` | `uninstallListeners()`
`void` | `uninstallUI(JComponent c)`

Methods inherited from class javax.swing.plaf.ComponentUI
`contains, getAccessibleChild, getAccessibleChildrenCount, update`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### progressBar

    protected JProgressBar progressBar

### changeListener

    protected ChangeListener changeListener

Constructor Detail

### BasicProgressBarUI

    public BasicProgressBarUI()

Method Detail

### createUI

    public static ComponentUI createUI(JComponent x)

### installUI

    public void installUI(JComponent c)

  Overrides:
    installUI in class ComponentUI

### uninstallUI

    public void uninstallUI(JComponent c)

  Overrides:
    uninstallUI in class ComponentUI

### installDefaults

    protected void installDefaults()

### uninstallDefaults

    protected void uninstallDefaults()

### installListeners

    protected void installListeners()

### uninstallListeners

    protected void uninstallListeners()

### getPreferredInnerHorizontal

    protected java.awt.Dimension getPreferredInnerHorizontal()

### getPreferredInnerVertical

    protected java.awt.Dimension getPreferredInnerVertical()

### getSelectionForeground

    protected java.awt.Color getSelectionForeground()

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

### getSelectionBackground

    protected java.awt.Color getSelectionBackground()

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

### getCellLength

    protected int getCellLength()

  Returns the width (if HORIZONTAL) or height (if VERTICAL) of each of the indivdual 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:
    the value representing the spacing between cells
  See Also:
    `setCellLength`, `JProgressBar.isStringPainted`

### setCellLength

    protected void setCellLength(int cellLen)

### getCellSpacing

    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:
    the value representing the spacing between cells
  See Also:
    `setCellSpacing`, `JProgressBar.isStringPainted`

### setCellSpacing

    protected void setCellSpacing(int cellSpace)

### getAmountFull

    protected int getAmountFull(java.awt.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.

### paint

    public void paint(java.awt.Graphics g,
                      JComponent c)

  All purpose paint method that should do the right thing for almost all linear 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.
  Overrides:
    paint in class ComponentUI

### paintString

    protected void paintString(java.awt.Graphics g,
                               int x,
                               int y,
                               int width,
                               int height,
                               int amountFull,
                               java.awt.Insets b)

### getStringPlacement

    protected java.awt.Point getStringPlacement(java.awt.Graphics g,
                                                java.lang.String progressString,
                                                int x,
                                                int y,
                                                int width,
                                                int height)

  Designate the place where the progress string will be drawn. 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.

### getPreferredSize

    public java.awt.Dimension getPreferredSize(JComponent c)

  Overrides:
    getPreferredSize in class ComponentUI

### getMinimumSize

    public java.awt.Dimension getMinimumSize(JComponent c)

  The Minimum size for this component is 10. The rationale here is that there should be at least one pixel per 10 percent.
  Overrides:
    getMinimumSize in class ComponentUI

### getMaximumSize

    public java.awt.Dimension getMaximumSize(JComponent c)

  Overrides:
    getMaximumSize in class ComponentUI

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Swing 1.1
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Submit a bug or feature
Java is a trademark or registered trademark of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-1998 Sun Microsystems, Inc. 901 San Antonio Road,
Palo Alto, California, 94303, U.S.A. All Rights Reserved.