|
JClass DesktopViews 6.3.0 API Documentation |
|||||||||
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.klg.jclass.swing.gauge.JCGauge | +--com.klg.jclass.swing.gauge.JCCircularGauge
JCCircularGauge
models a real-world gauge, such as you might
see on a car dashboard. This class encapsulates the available types of
circular gauges: full circle, semicircle, and quadrant.
Nested Class Summary | |
static class |
JCCircularGauge.GaugeType
Enums for gauge types. |
Nested classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Nested classes inherited from class java.awt.Container |
Container.AccessibleAWTContainer |
Nested classes inherited from class java.awt.Component |
Component.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategy |
Field Summary | |
protected com.klg.jclass.swing.gauge.JCCenter |
center
The center object. |
protected JCCircularGauge.GaugeType |
gaugeType
The type of gauge; full circle, semicircle, or quadrant. |
protected Vector |
labels
The list of labels for this gauge. |
Fields inherited from class com.klg.jclass.swing.gauge.JCGauge |
draggedNeedle, footer, footerLayoutHints, gaugeArea, gaugeAreaLayoutHints, header, headerLayoutHints, image, indicators, legend, legendLayoutHints, needles, pickListeners, repaintEnabled, scale, scaleImage, snapToValue |
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 | |
JCCircularGauge()
No-argument constructor for JCCircularGauge . |
|
JCCircularGauge(boolean createScale)
Constructs a JCCircularGauge with no default objects except
possibly a circular scale. |
|
JCCircularGauge(JCCircularGauge.GaugeType gaugeType)
Constructs a gauge of the specified gauge type. |
Method Summary | |
void |
addLabel(JComponent label,
com.klg.jclass.swing.gauge.RadialConstraint constraint)
Adds a label to the gauge. |
void |
addLabel(JComponent label,
com.klg.jclass.swing.gauge.RadialConstraint constraint,
int index)
Adds a label to the gauge. |
protected void |
drawImage(Graphics g,
Image image,
Rectangle bounds,
Color color)
Draws an image as the gauge background. |
Rectangle |
getArcBounds()
Determines the x, y, width and height of an arc's bounding box. |
com.klg.jclass.swing.gauge.JCCenter |
getCenter()
Returns the center for this gauge. |
com.klg.jclass.swing.gauge.JCCircularScale |
getCircularScale()
Returns the circular gauge's circular scale (appropriately cast). |
com.klg.jclass.swing.gauge.JCCircularNeedle |
getClosestNeedle(com.klg.jclass.swing.gauge.JCGaugePickEvent pe,
JCAbstractNeedle.InteractionType interactionType)
Returns the closest needle to the clicked/dragged point. |
JCCircularGauge.GaugeType |
getGaugeType()
Gets the gauge type, one of the JCCircularGauge.GaugeType enums. |
Graphics |
getGraphics()
Overrides parent getGraphics() . |
void |
mouseClicked(MouseEvent event)
Sends pick events to listeners and moves the closest needle with a CLICK interaction enabled to the value indicated
by the mouse click. |
void |
mouseDragged(MouseEvent event)
Drags the closest needle. |
void |
paintComponent(Graphics g)
Paints the gauge. |
void |
redraw()
Call this instead of paint so that the repaintEnabled flag can
be checked. |
void |
removeLabel(JComponent label)
Removes a label. |
void |
serverPaint(Graphics igc)
Internal use only. |
Image |
serverSnapshot()
Internal use only. |
void |
setCenter(com.klg.jclass.swing.gauge.JCCenter center)
Sets the center for this gauge. |
void |
setCenter(com.klg.jclass.swing.gauge.JCCenter center,
int index)
Sets the center object for this gauge. |
void |
setGaugeType(JCCircularGauge.GaugeType gaugeType)
Sets the type for this gauge, one of the JCCircularGauge.GaugeType enums. |
void |
setGraphics(Graphics g)
Provides a way for the circular gauge to draw to a custom Graphics object. |
void |
setScale(com.klg.jclass.swing.gauge.JCCircularScale scale)
Adds a circular scale to the circular gauge. |
void |
setScale(com.klg.jclass.swing.gauge.JCCircularScale scale,
boolean addToGaugeArea)
Adds a circular scale to the circular gauge. |
protected double |
valueToAngle(double value)
A convenience method that returns the angle corresponding to a circular scale value. |
Methods inherited from class com.klg.jclass.swing.gauge.JCGauge |
addIndicator, addIndicator, addNeedle, addNeedle, addPickListener, addRange, addRange, addTick, addTick, getAbout, getComponentArea, getDrawingAreaHeight, getDrawingAreaWidth, getFooter, getGaugeArea, getHeader, getImage, getIndicators, getLayoutHints, getLegend, getNeedles, getRanges, getRepaintEnabled, getScale, getScaleImage, getSnapToValue, getTicks, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, pick, removeIndicator, removeNeedle, removePickListener, removeRange, removeTick, sendPickEvent, setAbout, setFooter, setGaugeArea, setHeader, setImage, setIndicatorScales, setLegend, setNeedleScales, setRepaintEnabled, setScaleImage, setSnapToValue |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface com.klg.jclass.util.legend.LegendComponentLayoutUser |
getPreferredSize |
Field Detail |
protected JCCircularGauge.GaugeType gaugeType
protected com.klg.jclass.swing.gauge.JCCenter center
protected Vector labels
JCLabelGenerator
Constructor Detail |
public JCCircularGauge()
JCCircularGauge
.
Creates a default center, needle, and tick marks.
setScale(JCCircularScale)
,
setCenter(JCCenter)
,
JCGauge.addNeedle(JCAbstractNeedle)
,
JCGauge.addTick(JCTick)
,
JCGauge.getScale()
,
getCenter()
,
JCGauge.removeNeedle(JCAbstractNeedle)
,
JCGauge.removeTick(JCTick)
public JCCircularGauge(boolean createScale)
JCCircularGauge
with no default objects except
possibly a circular scale.
Use the following methods to add needles, indicators, ticks, and ranges.
createScale
- setScale(JCCircularScale)
,
setCenter(JCCenter)
,
JCGauge.addIndicator(JCAbstractIndicator)
,
JCGauge.addNeedle(JCAbstractNeedle)
,
JCAbstractScale.addRange(JCRange)
,
JCGauge.addTick(JCTick)
,
JCGauge.getScale()
,
getCenter()
,
JCGauge.removeIndicator(JCAbstractIndicator)
,
JCGauge.removeNeedle(JCAbstractNeedle)
,
JCAbstractScale.removeRange(JCRange)
,
JCGauge.removeTick(JCTick)
public JCCircularGauge(JCCircularGauge.GaugeType gaugeType)
gaugeType
- one of the constants defined in this classsetScale(JCCircularScale)
,
setCenter(JCCenter)
,
JCGauge.addIndicator(JCAbstractIndicator)
,
JCGauge.addNeedle(JCAbstractNeedle)
,
JCAbstractScale.addRange(JCRange)
,
JCGauge.addTick(JCTick)
,
JCGauge.getScale()
,
getCenter()
,
JCGauge.removeIndicator(JCAbstractIndicator)
,
JCGauge.removeNeedle(JCAbstractNeedle)
,
JCAbstractScale.removeRange(JCRange)
,
JCGauge.removeTick(JCTick)
Method Detail |
public void paintComponent(Graphics g)
paintComponent
in class JComponent
g
- the Graphics
with which to paintpublic com.klg.jclass.swing.gauge.JCCircularScale getCircularScale()
public void setScale(com.klg.jclass.swing.gauge.JCCircularScale scale, boolean addToGaugeArea)
scale
- the circular scale to be addedaddToGaugeArea
- add the scale to the gauge's gaugeArea
?public void setScale(com.klg.jclass.swing.gauge.JCCircularScale scale)
scale
- the circular scale to be addedpublic void addLabel(JComponent label, com.klg.jclass.swing.gauge.RadialConstraint constraint)
label
- the JComponent
to be added as a labelconstraint
- the RadialConstraint
specifying where to
place the labelpublic void addLabel(JComponent label, com.klg.jclass.swing.gauge.RadialConstraint constraint, int index)
label
- the JComponent
to be added as a labelconstraint
- the RadialConstraint
specifying where to
place the labelindex
- the z-order indexpublic void removeLabel(JComponent label)
label
- the JComponent
to be removedpublic com.klg.jclass.swing.gauge.JCCenter getCenter()
JCCenter
object associated with this gaugepublic void setCenter(com.klg.jclass.swing.gauge.JCCenter center, int index)
center
- the JCCenter
for this gaugeindex
- the z-order index at which to add the centerpublic void setCenter(com.klg.jclass.swing.gauge.JCCenter center)
center
- the JCCenter
for this gaugepublic JCCircularGauge.GaugeType getGaugeType()
JCCircularGauge.GaugeType
enums.
public void setGaugeType(JCCircularGauge.GaugeType gaugeType)
JCCircularGauge.GaugeType
enums.
gaugeType
- the gauge type, full circle, semicircle, or quadrant.public Rectangle getArcBounds()
Rectangle
bounding the arcpublic void mouseClicked(MouseEvent event)
CLICK
interaction enabled to the value indicated
by the mouse click.
mouseClicked
in interface MouseListener
mouseClicked
in class JCGauge
event
- a MouseEvent
public void mouseDragged(MouseEvent event)
mouseDragged
in interface MouseMotionListener
mouseDragged
in class JCGauge
event
- a MouseEvent
public com.klg.jclass.swing.gauge.JCCircularNeedle getClosestNeedle(com.klg.jclass.swing.gauge.JCGaugePickEvent pe, JCAbstractNeedle.InteractionType interactionType)
CLICK
/DRAG
/CLICK_DRAG
,
or if there are none of these, the closest needle of type NONE
.
pe
- the pick event with the click inforamationinteractionType
- the needle must be
JCNeedle.InteractionType
protected double valueToAngle(double value)
value
- a circular scale value
public void redraw()
repaintEnabled
flag can
be checked. No repaint will occur if that flag is false
.
redraw
in class JCGauge
protected void drawImage(Graphics g, Image image, Rectangle bounds, Color color)
g
- the Graphics on which to drawbounds
- color
- image
- public Graphics getGraphics()
getGraphics()
. If another
Graphics
object has been set to be the current one, it is
returned. Otherwise, call the superclass' getGraphics()
method.
getGraphics
in interface com.klg.jclass.util.ServerRenderable
getGraphics
in class JComponent
Graphics
object to use to draw this chartpublic void setGraphics(Graphics g)
Graphics
object. Call with a null to specify use of the default
Graphics
object used to draw to the screen.
setGraphics
in interface com.klg.jclass.util.ServerRenderable
g
- Graphics
object to use for drawingpublic Image serverSnapshot()
serverSnapshot
in interface com.klg.jclass.util.ServerRenderable
public void serverPaint(Graphics igc)
serverPaint
in interface com.klg.jclass.util.ServerRenderable
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |