|
JClass 4.5.0 API Documentation |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | 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.
Inner Class Summary | |
static class |
JCCircularGauge.GaugeType
Enums for gauge types. |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Field Summary | |
protected 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,
legend,
legendLayoutHints,
needles,
pickListeners,
ranges,
repaintEnabled,
scale,
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 |
Constructor Summary | |
JCCircularGauge()
No-argument constructor for JCCircularGauge . |
|
JCCircularGauge(JCCircularGauge.GaugeType gaugeType)
Constructs a gauge of the specified gauge type. |
Method Summary | |
void |
addLabel(JComponent label,
RadialConstraint constraint)
Adds a label to the gauge. |
void |
addLabel(JComponent label,
RadialConstraint constraint,
int index)
Adds a label to the gauge. |
protected Rectangle |
getArcBounds()
Determines the x, y, width and height of an arc's bounding box. |
JCCenter |
getCenter()
Returns the center for this gauge. |
JCNeedle |
getClosestNeedle(JCGaugePickEvent pe,
JCNeedle.InteractionType interactionType)
Returns the closest needle to the clicked/dragged point. |
JCCircularGauge.GaugeType |
getGaugeType()
Gets the gauge type, one of the JCCircularGauge.GaugeType enums. |
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 |
setCenter(JCCenter center)
Sets the center for this gauge. |
void |
setCenter(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. |
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 |
addNeedle,
addNeedle,
addPickListener,
addRange,
addRange,
addTick,
addTick,
getComponentArea,
getDrawingAreaHeight,
getDrawingAreaWidth,
getFooter,
getGaugeArea,
getHeader,
getLayoutHints,
getLegend,
getNeedles,
getRanges,
getRepaintEnabled,
getScale,
getSnapToValue,
getTicks,
mouseEntered,
mouseExited,
mouseMoved,
mousePressed,
mouseReleased,
pick,
removeNeedle,
removePickListener,
removeRange,
removeTick,
sendPickEvent,
setFooter,
setGaugeArea,
setHeader,
setLegend,
setRepaintEnabled,
setScale,
setSnapToValue |
Methods inherited from class java.awt.Container |
add,
add,
add,
add,
add,
addContainerListener,
addImpl,
countComponents,
deliverEvent,
doLayout,
findComponentAt,
findComponentAt,
getComponent,
getComponentAt,
getComponentAt,
getComponentCount,
getComponents,
getLayout,
insets,
invalidate,
isAncestorOf,
layout,
list,
list,
locate,
minimumSize,
paintComponents,
preferredSize,
print,
printComponents,
processContainerEvent,
processEvent,
remove,
remove,
removeAll,
removeContainerListener,
setCursor,
setLayout,
validate,
validateTree |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
protected JCCircularGauge.GaugeType gaugeType
protected JCCenter center
protected Vector labels
JCLabelGenerator
Constructor Detail |
public JCCircularGauge()
JCCircularGauge
.
Creates a default center, needle, and tick marks.JCGauge.setScale(JCCircularScale)
,
setCenter(JCCenter)
,
JCGauge.addNeedle(JCNeedle)
,
JCGauge.addTick(JCTick)
,
JCGauge.getScale()
,
getCenter()
,
JCGauge.removeNeedle(JCNeedle)
,
JCGauge.removeTick(JCTick)
public JCCircularGauge(JCCircularGauge.GaugeType gaugeType)
gaugeType
- One of the constants defined in this class.JCGauge.setScale(JCCircularScale)
,
setCenter(JCCenter)
,
JCGauge.addNeedle(JCNeedle)
,
JCGauge.addTick(JCTick)
,
JCGauge.getScale()
,
getCenter()
,
JCGauge.removeNeedle(JCNeedle)
,
JCGauge.removeTick(JCTick)
Method Detail |
public void paintComponent(Graphics g)
g
- The Graphics
with which to paintpublic void addLabel(JComponent label, RadialConstraint constraint)
label
- The JComponent
to be added as a labelconstraint
- The RadialConstraint
specifying where to
place the labelpublic void addLabel(JComponent label, 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 JCCenter getCenter()
JCCenter
object associated with this gauge.public void setCenter(JCCenter center, int index)
center
- The JCCenter
for this gaugeindex
- The z-order index at which to add the centerpublic void setCenter(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.protected Rectangle getArcBounds()
Rectangle
bounding the arcpublic void mouseClicked(MouseEvent event)
CLICK
interaction enabled to the value indicated
by the mouse click.event
- A MouseEvent
public void mouseDragged(MouseEvent event)
event
- A MouseEvent
public JCNeedle getClosestNeedle(JCGaugePickEvent pe, JCNeedle.InteractionType interactionType)
pe
- The pick event with the click inforamationinteractionType
- The needle must be of this
JCNeedle.InteractionType
protected double valueToAngle(double value)
value
- A circular scale value.public void redraw()
|
Copyright© 1999-2000 KL Group Inc. All rights reserved. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |