|
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.JCNeedle
A needle points to values on its scale. There may be multiple needles associated with a scale.
JCNeedleStyle
, Serialized FormInner Class Summary | |
static class |
JCNeedle.InteractionType
Needle interaction types. |
Inner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Field Summary | |
protected ChangeEvent |
changeEvent
Reuse the same event for notifications. |
protected com.klg.jclass.util.JCListenerList |
changeListeners
List of listeners interested in knowing when a needle's value has changed. |
protected JCCircularGauge |
gauge
The associated gauge. |
protected JCNeedle.InteractionType |
interactionType
The type of interaction, one of InteractionType.NONE InteractionType.DRAG InteractionType.CLICK InteractionType CLICK_DRAG |
protected double |
length
The length of the needle as a ratio of the scale's radius. |
protected JCNeedleStyle |
needleStyle
The needle style, one of, JCNeedleStyle.ARROW JCNeedleStyle.POINTER JCNeedleStyle.TRIANGLE or a user-defined instance of the JCNeedleStyle class |
protected double |
needleWidth
The needle width in pixels. |
protected boolean |
sendEvents
Controls whether to send change events or not. |
protected double |
value
The scale value at which this needle should point. |
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 | |
JCNeedle(Color foreground,
double needleWidth,
JCCircularGauge gauge,
JCNeedle.InteractionType interactionType,
boolean visible,
double length,
JCNeedleStyle needleStyle,
double value)
Create a needle. |
|
JCNeedle(JCCircularGauge gauge)
Creates a needle. |
Method Summary | |
void |
addChangeListener(ChangeListener l)
Adds listener interested in needle movements. |
JCCircularGauge |
getGauge()
Returns the gauge associated with this scale. |
JCNeedle.InteractionType |
getInteractionType()
Returns the interation type for this needle. |
double |
getLength()
Returns the length of this needle as a ratio of the scale's radius. |
JCNeedleStyle |
getNeedleStyle()
Returns the JCNeedleStyle for this needle. |
double |
getNeedleWidth()
Returns the needle width in pixels. |
Dimension |
getPreferredSize()
Returns the preferred size for this component. |
boolean |
getSendEvents()
Returns a sendEvents flag; true means events will be sent when the
needle's value changes, false means don't send the events. |
double |
getValue()
Returns the scale value at which this needle is currently pointing. |
void |
paint(Graphics g)
This routine actually draws the needle object on the screen. |
void |
redraw()
Call this instead of paint so that the repaintEnabled flag can be checked. |
void |
removeChangeListener(ChangeListener l)
Removes listener interested in needle movements. |
void |
sendChangeEvent(ChangeEvent ev)
Broadcasts the move event to interested listeners. |
void |
setGauge(JCCircularGauge gauge)
Sets the gauge associated with this scale. |
void |
setInteractionType(JCNeedle.InteractionType interactionType)
Sets the interation type for this needle. |
void |
setLength(double length)
Sets the length of this needle as a ratio of the scale's radius. |
void |
setNeedleStyle(JCNeedleStyle needleStyle)
Sets the JCNeedleStyle for this needle. |
void |
setNeedleWidth(double needleWidth)
Sets the needle width in pixels. |
void |
setSendEvents(boolean sendEvents)
Sets the sendEvents flag; true means events will be sent when the
needle's value changes, false means don't send the events. |
void |
setValue(double value)
Sets the scale value to which this needle should point. |
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 double needleWidth
protected JCCircularGauge gauge
protected com.klg.jclass.util.JCListenerList changeListeners
protected ChangeEvent changeEvent
protected boolean sendEvents
protected JCNeedle.InteractionType interactionType
protected double length
protected JCNeedleStyle needleStyle
protected double value
Constructor Detail |
public JCNeedle(JCCircularGauge gauge)
gauge
- The parent circular gaugepublic JCNeedle(Color foreground, double needleWidth, JCCircularGauge gauge, JCNeedle.InteractionType interactionType, boolean visible, double length, JCNeedleStyle needleStyle, double value)
foreground
- The needle's colorneedleWidth
- The needle's width in pixelsgauge
- The associated circular gaugeinteractionType
- The interaction type,
CLICK
, CLICK_DRAG
, or NONE
visible
- A Boolean that controls the visibility of the needlelength
- The needle's length, expressed as a ratio of its length to
the radius of the associated circular scaleneedleStyle
- Needle styles are kept in JCNeedleStyle
.
User-defined needle styles may be passed to
JCNeedleStyle
's constructor.value
- The needles value. The needle points to this value on its
associated scaleMethod Detail |
public Dimension getPreferredSize()
public void paint(Graphics g)
g
- public void addChangeListener(ChangeListener l)
l
- public void removeChangeListener(ChangeListener l)
l
- public void sendChangeEvent(ChangeEvent ev)
ev
- The ChangeEvent of interestpublic double getValue()
public void setValue(double value)
value
- The value at which to pointpublic double getLength()
public void setLength(double length)
length
- The length of this needle as a ratio of the scale's radiuspublic JCCircularGauge getGauge()
public void setGauge(JCCircularGauge gauge)
gauge
- The gaugepublic JCNeedleStyle getNeedleStyle()
JCNeedleStyle
for this needle.JCNeedleStyle
of this needlepublic void setNeedleStyle(JCNeedleStyle needleStyle)
JCNeedleStyle
for this needle.needleStyle
- The JCNeedleStyle
for this needlepublic JCNeedle.InteractionType getInteractionType()
JCNeedle.InteractionType
for this needlepublic void setInteractionType(JCNeedle.InteractionType interactionType)
interactionType
- The JCNeedle.InteractionType
for this
needle, one of InteractionType NONE
InteractionType DRAG
InteractionType.CLICK
InteractionType CLICK_DRAG
public double getNeedleWidth()
public void setNeedleWidth(double needleWidth)
needleWidth
- The needle width in pixelspublic boolean getSendEvents()
sendEvents
flag; true means events will be sent when the
needle's value changes, false means don't send the events.public void setSendEvents(boolean sendEvents)
sendEvents
flag; true means events will be sent when the
needle's value changes, false means don't send the events.sendEvents
- true means send needle's value change events to
listeners, false means don't.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 |