|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent com.jidesoft.gauge.AbstractGauge<DialAxis> com.jidesoft.gauge.Dial
public class Dial
The main class for displaying circular gauges - or gauges that form part of a circle. The gauge class supports multiple needles, and you can configure the appearance of needles with a NeedleStyle.
The dimensions of dial-related properties and needles are generally specified in terms of the radius of the dial so that the proportions of the dial objects remain unchanged under resizing. In other words, the same dial object will look good whether large or small.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
---|---|
static String |
PROPERTY_DIAL_BACKGROUND
|
Fields inherited from class com.jidesoft.gauge.AbstractGauge |
---|
DEFAULT_NEEDLE_NAME, PROPERTY_BACKGROUND_PAINT, PROPERTY_RESIZE_FONTS |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
Dial()
Create a new Dial instance. |
Method Summary | |
---|---|
void |
addAxis(DialAxis axis)
|
void |
addDrawable(Drawable drawable)
Adds a Drawable object to the dial |
void |
addNeedle(String needleName,
NeedleStyle style)
Adds a needle and associates it with the specified needle name |
protected Point2D |
calculatePixelPoint2D(DialAxis axis,
double axisValue)
|
GeneralPath |
createSegment(double fromAngle,
double toAngle,
double innerRadius,
double outerRadius)
|
protected Paint |
deriveFacePaint(Color faceColor,
float x,
float y,
float radius)
|
Double |
getAngle(DialAxis axis,
Double value)
Returns the angle (in degrees) of the value on the supplied axis, or null if the supplied value is null. |
Double |
getAngle(Double value)
Returns the angle of the value on the primary axis |
GaugeModel |
getAnimatedModel()
|
DialAxis |
getAxis()
Returns the primary axis for the dial |
Paint |
getDialBackground()
Deprecated. in favour of getGaugeBackground() |
double |
getEndAngle()
|
Color |
getFaceColor()
Returns the base color of the face of the display |
Paint |
getFacePaint()
The current Paint used for the face of the Dial. |
DialFrame |
getFrame()
|
int |
getNeedleAnimationPeriod()
|
double |
getNeedleAnimationSpeed()
|
List<String> |
getNeedleNames()
|
NeedleRenderer |
getNeedleRenderer(String name)
Returns the needle renderer for the specified needle |
NeedleStyle |
getNeedleStyle(String needleName)
Returns the display style associated with the specified needle |
int |
getPivotX()
|
int |
getPivotY()
|
float |
getRadius()
Returns a radius in pixels |
double |
getStartAngle()
|
Color |
getTickColor()
|
boolean |
isAnimateOnChange()
Returns a boolean to indicate whether animation is being used to show needle changes |
NeedleDescriptor |
needleAt(Point2D p)
Determines whether there is a needle at the specified pixel position. |
Collection<NeedleDescriptor> |
needlesAt(Point2D p)
Determines which needles, if any, are at the specified pixel position, returning a collection of descriptor objects that describe the needles. |
static double |
normalizeAngle(double angle)
Reduces an angle value (given in degrees) to a value in the range [0, 360) |
void |
paintComponent(Graphics g)
The main method for painting the display |
void |
removeAxis(DialAxis axis)
|
void |
removeDrawable(Drawable drawable)
Removes the specified Drawable from the dial |
void |
removeDrawables()
Removes all Drawables from the dial |
void |
removeNeedle(String name)
Removes the named needle from the dial |
void |
removeNeedleRenderer(String name)
Remove the renderer associated with the specified needle |
void |
removeNeedles()
Removes all needles from the dial |
NeedleDescriptor |
rendered(String needleName)
Returns a NeedleDescriptor object for the named needle |
void |
setAnimatedModel(GaugeModel animatedModel)
|
void |
setAnimateOnChange(boolean animateOnChange)
Specify whether animation should be used to move needles when the value changes. |
void |
setAxis(DialAxis axis)
Specify the axis to use for the dial. |
void |
setDialBackground(Paint background)
Deprecated. in favour of setBackgroundPaint() |
void |
setEndAngle(double endAngle)
Sets the end angle for the gauge as a value in degrees |
void |
setFaceColor(Color faceColor)
Sets the base color of the face of the display |
void |
setFacePaint(Paint facePaint)
Sets the paint to use for filling the face of a Dial. |
void |
setFrame(DialFrame frame)
|
void |
setNeedleAnimationPeriod(int needleAnimationPeriod)
|
void |
setNeedleAnimationSpeed(double needleAnimationSpeed)
|
void |
setNeedleRenderer(String name,
NeedleRenderer renderer)
Specify the needle renderer to use with the specified needle |
void |
setNeedleStyle(String needleName,
NeedleStyle style)
Specify the style to use with the specified needle |
void |
setStartAngle(double startAngle)
Sets the start angle for the gauge as a value in degrees |
void |
setTickColor(Color tickColor)
Sets the color of the ticks (value markers) in the display |
void |
setValue(String needleName,
Positionable pos,
boolean fireUpdate)
Set the value of the specified needle on the primary axis |
void |
update()
Update by forcing a re-drawing of the dial face |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.jidesoft.chart.ResizableComponent |
---|
addComponentListener |
Field Detail |
---|
public static final String PROPERTY_DIAL_BACKGROUND
Constructor Detail |
---|
public Dial()
Method Detail |
---|
public List<String> getNeedleNames()
public GaugeModel getAnimatedModel()
public void setAnimatedModel(GaugeModel animatedModel)
public DialAxis getAxis()
public void setAxis(DialAxis axis)
axis
- the DialAxis instancepublic void addAxis(DialAxis axis)
public void removeAxis(DialAxis axis)
public void addNeedle(String needleName, NeedleStyle style)
needleName
- the name of the needlestyle
- the style to use when displaying the needlepublic void setNeedleStyle(String needleName, NeedleStyle style)
needleName
- the name of the needlestyle
- the display style associated with the needlepublic NeedleStyle getNeedleStyle(String needleName)
needleName
- the name of the needle
public void removeNeedle(String name)
name
- the name of the needle to removepublic void removeNeedles()
public void setNeedleRenderer(String name, NeedleRenderer renderer)
name
- the needle whose renderer is being specifiedrenderer
- the rendererpublic void removeNeedleRenderer(String name)
name
- the name of the needle whose renderer is to be removedpublic NeedleRenderer getNeedleRenderer(String name)
name
- the name of the needle
public void addDrawable(Drawable drawable)
drawable
- the Drawable to addDialIntervalMarker
,
DialLabel
public void removeDrawable(Drawable drawable)
drawable
- the drawable to removepublic void removeDrawables()
public boolean isAnimateOnChange()
public void setAnimateOnChange(boolean animateOnChange)
animateOnChange
- whether to use animation to move needlespublic double getNeedleAnimationSpeed()
public void setNeedleAnimationSpeed(double needleAnimationSpeed)
public int getNeedleAnimationPeriod()
public void setNeedleAnimationPeriod(int needleAnimationPeriod)
public void setValue(String needleName, Positionable pos, boolean fireUpdate)
setValue
in class AbstractGauge<DialAxis>
needleName
- the needle whose value we are settingpos
- a Positionable object that carries the value of the needle (and possibly other information
too)fireUpdate
- specify whether an update event should be fired on the modelpublic Color getFaceColor()
public void setFaceColor(Color faceColor)
faceColor
- the new color of the displaypublic Paint getFacePaint()
setFacePaint(java.awt.Paint)
public void setFacePaint(Paint facePaint)
Note that if you call setFacePaint with an instance of Color, the method derives a Paint based on the Color. If you just want a plain Color, use setFaceColor instead.
facePaint
- the paint to use for the fill of the dial facepublic void setDialBackground(Paint background)
background
- the background Paintpublic Paint getDialBackground()
public Color getTickColor()
public void setTickColor(Color tickColor)
tickColor
- the new color of the ticks in the displaypublic double getStartAngle()
public void setStartAngle(double startAngle)
startAngle
- an angle in degreespublic double getEndAngle()
public void setEndAngle(double endAngle)
endAngle
- an angle in degreespublic NeedleDescriptor needleAt(Point2D p)
p
- the pixel point of enquiry
public Collection<NeedleDescriptor> needlesAt(Point2D p)
p
- the pixel point of interest
public NeedleDescriptor rendered(String needleName)
needleName
- the name of the needle of interest
public Double getAngle(Double value)
value
- the value for which we compute the appropriate angle for drawing
public Double getAngle(DialAxis axis, Double value)
axis
- the axis context for the supplied valuevalue
- the value for which we compute the appropriate angle for drawing
public static double normalizeAngle(double angle)
angle
- an angle in degrees
protected Paint deriveFacePaint(Color faceColor, float x, float y, float radius)
protected Point2D calculatePixelPoint2D(DialAxis axis, double axisValue)
calculatePixelPoint2D
in class AbstractGauge<DialAxis>
public DialFrame getFrame()
public void setFrame(DialFrame frame)
public float getRadius()
public int getPivotX()
public int getPivotY()
public void update()
public void paintComponent(Graphics g)
paintComponent
in class JComponent
public GeneralPath createSegment(double fromAngle, double toAngle, double innerRadius, double outerRadius)
|
JIDE 3.5.15 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |