Class PercentDial

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----PercentDial

public class PercentDial
extends Canvas
PercentDial is a custom component that takes a value between 0.0 and 1.0 (inclusive) and displays the corresponding fraction of a circle with a filled arc.


Constructor Index

 o PercentDial(int)
Contructor which assumes the default border thickness.
 o PercentDial(int, int)
Constructor which takes the width of the component (and incidentally the height) in pixels and the thickness of the border in pixels.

Method Index

 o getHeight()
The total height of the component in pixels.
 o getMinimumSize()
Overrides Component.getMinimumSize to return the minimum size of the Percent Dial.
 o getOutlineColor()
Returns the color for the outline of the circle.
 o getPreferredSize()
Overrides Component.getPreferredSize to return the preferred size of the Percent Dial.
 o getUnusedColor()
Returns the fill color for the portion of the circle which shows the fraction which is not used.
 o getUsedColor()
Returns the fill color for the portion of the circle which shows the fraction used.
 o getWidth()
The total width of the component in pixels.
 o minimumSize()
Still here for backward 1.0 compat
 o paint(Graphics)
Overrides paint() method to draw the percent dial.
 o preferredSize()
Still here for backward 1.0 compat
 o setCurrFrac(double)
Update the percent dial to show a new fraction of the circle.
 o setOutlineColor(Color)
Sets the color for the outline of the circle.
 o setUnusedColor(Color)
Sets the fill color for the portion of the circle which shows the fraction which is not used.
 o setUsedColor(Color)
Sets the fill color for the portion of the circle which shows the fraction used.

Constructors

 o PercentDial
 public PercentDial(int totalWidth,
                    int pixelBorder)
Constructor which takes the width of the component (and incidentally the height) in pixels and the thickness of the border in pixels. The diameter of the circle will be: width - 2*border pixels.

 o PercentDial
 public PercentDial(int totalWidth)
Contructor which assumes the default border thickness.

Methods

 o getWidth
 public int getWidth()
The total width of the component in pixels.

 o getHeight
 public int getHeight()
The total height of the component in pixels.

 o getPreferredSize
 public Dimension getPreferredSize()
Overrides Component.getPreferredSize to return the preferred size of the Percent Dial.

Overrides:
getPreferredSize in class Component
 o getMinimumSize
 public Dimension getMinimumSize()
Overrides Component.getMinimumSize to return the minimum size of the Percent Dial.

Overrides:
getMinimumSize in class Component
 o preferredSize
 public Dimension preferredSize()
Still here for backward 1.0 compat

Overrides:
preferredSize in class Component
 o minimumSize
 public Dimension minimumSize()
Still here for backward 1.0 compat

Overrides:
minimumSize in class Component
 o setUsedColor
 public void setUsedColor(Color c)
Sets the fill color for the portion of the circle which shows the fraction used.

 o setUnusedColor
 public void setUnusedColor(Color c)
Sets the fill color for the portion of the circle which shows the fraction which is not used.

 o setOutlineColor
 public void setOutlineColor(Color c)
Sets the color for the outline of the circle.

 o getUsedColor
 public Color getUsedColor()
Returns the fill color for the portion of the circle which shows the fraction used.

 o getUnusedColor
 public Color getUnusedColor()
Returns the fill color for the portion of the circle which shows the fraction which is not used.

 o getOutlineColor
 public Color getOutlineColor()
Returns the color for the outline of the circle.

 o paint
 public void paint(Graphics g)
Overrides paint() method to draw the percent dial.

Overrides:
paint in class Canvas
 o setCurrFrac
 public void setCurrFrac(double currFrac)
Update the percent dial to show a new fraction of the circle. The currFrac value should be in the range 0.0 to 1.0 (inclusive).