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.
-
PercentDial(int)
- Contructor which assumes the default border thickness.
-
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.
-
getHeight()
- The total height of the component in pixels.
-
getMinimumSize()
-
Overrides Component.getMinimumSize to return the minimum
size of the Percent Dial.
-
getOutlineColor()
- Returns the color for the outline of the circle.
-
getPreferredSize()
-
Overrides Component.getPreferredSize to return the preferred
size of the Percent Dial.
-
getUnusedColor()
- Returns the fill color for the portion of the circle which shows the
fraction which is not used.
-
getUsedColor()
- Returns the fill color for the portion of the circle which shows the
fraction used.
-
getWidth()
- The total width of the component in pixels.
-
minimumSize()
- Still here for backward 1.0 compat
-
paint(Graphics)
- Overrides paint() method to draw the percent dial.
-
preferredSize()
- Still here for backward 1.0 compat
-
setCurrFrac(double)
- Update the percent dial to show a new fraction of the circle.
-
setOutlineColor(Color)
- Sets the color for the outline of the circle.
-
setUnusedColor(Color)
- Sets the fill color for the portion of the circle which shows the
fraction which is not used.
-
setUsedColor(Color)
- Sets the fill color for the portion of the circle which shows the
fraction used.
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.
PercentDial
public PercentDial(int totalWidth)
- Contructor which assumes the default border thickness.
getWidth
public int getWidth()
- The total width of the component in pixels.
getHeight
public int getHeight()
- The total height of the component in pixels.
getPreferredSize
public Dimension getPreferredSize()
- Overrides Component.getPreferredSize to return the preferred
size of the Percent Dial.
- Overrides:
- getPreferredSize in class Component
getMinimumSize
public Dimension getMinimumSize()
- Overrides Component.getMinimumSize to return the minimum
size of the Percent Dial.
- Overrides:
- getMinimumSize in class Component
preferredSize
public Dimension preferredSize()
- Still here for backward 1.0 compat
- Overrides:
- preferredSize in class Component
minimumSize
public Dimension minimumSize()
- Still here for backward 1.0 compat
- Overrides:
- minimumSize in class Component
setUsedColor
public void setUsedColor(Color c)
- Sets the fill color for the portion of the circle which shows the
fraction used.
setUnusedColor
public void setUnusedColor(Color c)
- Sets the fill color for the portion of the circle which shows the
fraction which is not used.
setOutlineColor
public void setOutlineColor(Color c)
- Sets the color for the outline of the circle.
getUsedColor
public Color getUsedColor()
- Returns the fill color for the portion of the circle which shows the
fraction used.
getUnusedColor
public Color getUnusedColor()
- Returns the fill color for the portion of the circle which shows the
fraction which is not used.
getOutlineColor
public Color getOutlineColor()
- Returns the color for the outline of the circle.
paint
public void paint(Graphics g)
- Overrides paint() method to draw the percent dial.
- Overrides:
- paint in class Canvas
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).