|
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.JCTick
A graduated scale marker object. It comprises a set of uniformly spaced tick marks.
JCCircularTick
, Serialized FormInner classes inherited from class javax.swing.JComponent |
JComponent.AccessibleJComponent |
Field Summary | |
protected boolean |
automatic
The automatic boolean determines whether tick increments are calculated automatically
or set by the incrementValue property. |
protected boolean |
drawLabels
If true, draw tick labels, otherwise don't. |
protected boolean |
drawTicks
If true, draw tick marks, otherwise don't. |
protected Color |
fontColor
The color of the font labeling ticks. |
protected double |
incrementValue
If not automatic, the scale values at which tick marks are to be placed. |
protected double |
innerExtent
The percentage of the scale's radius (as a decimal) at at which to begin drawing ticks radially outward. |
protected double |
labelExtent
The percentage, expressed as a decimal fraction of the scale's radius, at which to place tick labels. |
protected JCLabelGenerator |
labelGenerator
A custom label generator. |
protected double |
outerExtent
The percentage of the scale's radius (as a decimal) at which to stop drawing the ticks. |
protected int |
precision
If precisionUseDefault is false, use this precision. |
protected boolean |
precisionUseDefault
If true, use gauge-determined precision. |
protected JCCircularScale |
scale
The scale associated with this tick. |
protected double |
startValue
The startValue is the scale value at which to begin this set oftick marks. |
protected double |
stopValue
The stopValue is the scale value at which this set of tick marks ends. |
protected Color |
tickColor
The color in which to draw ticks. |
protected JCTickStyle |
tickStyle
The JCTickStyle controlling the shape of the tick. |
protected double |
tickWidth
The width of a tick in pixels. |
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 | |
JCTick(JCCircularScale scale,
boolean automatic,
double startValue,
double stopValue,
double incrementValue,
boolean precisionUseDefault,
int precision,
double tickWidth,
boolean drawLabels,
boolean drawTicks,
double labelExtent,
double innerExtent,
double outerExtent,
Color tickColor,
JCTickStyle tickStyle,
Font font,
Color fontColor)
Create a tick object and set its properties. |
|
JCTick(JCCircularScale scale,
double startValue,
double stopValue)
Create ticks. |
Method Summary | |
protected void |
calcPrecision(double min,
double max)
Determine and set a "nice" precision to use if useDefaultPrecision
is set to true. |
protected void |
calcTicks(Graphics g)
If "automatic," this method is called to determine and set the start/stop and increment values for laying out ticks. |
boolean |
getAutomatic()
Returns the automatic Boolean for this tick object. |
boolean |
getDrawLabels()
Returns the Boolean controlling the drawing of labels. |
boolean |
getDrawTicks()
Returns the Boolean controlling the drawing of ticks. |
Color |
getFontColor()
Returns the color of the font labeling ticks. |
double |
getIncrementValue()
In non-automatic mode, uses this value as the increment value, that is, places ticks at every incrementValue along the scale. |
double |
getInnerExtent()
Returns the percentage of the scale's radius (as a decimal) at at which to begin drawing ticks radially outward. |
double |
getLabelExtent()
Returns the position, expressed as a decimal fraction of the scale's radius, where tick labels are placed. |
JCLabelGenerator |
getLabelGenerator()
Returns the label generator associated with this tick. |
double |
getOuterExtent()
Returns the percentage of the scale's radius (as a decimal) at which to stop drawing the ticks. |
int |
getPrecision()
Returns the format for numbers in a tick label: positive values denote the number of places after the decimal point (for example, 3 means multiples of 0.001); negative values indicate the positive number of zeros are used before the decimal place (for example, -3 means numbering will be in multiples of 1000). |
boolean |
getPrecisionUseDefault()
If true, uses gauge-determined precision for tick labels, otherwise uses setPrecision to label tick marks. |
JCCircularScale |
getScale()
Returns the scale associated with this tick object. |
double |
getStartValue()
In non-automatic mode, uses this value as the start value. |
double |
getStopValue()
In non-automatic mode, uses this value as the stop value. |
Color |
getTickColor()
Returns the color in which to draw ticks. |
JCTickStyle |
getTickStyle()
Returns the JCTickStyle controlling the shape of the tick. |
double |
getTickWidth()
Returns the width in pixels of the tick mark. |
static double |
niceNum(double x,
int exp,
boolean round)
Given x, nudge it towards a "nice" number. |
void |
paintChildren(Graphics g)
Controls whether labels should be drawn according to the drawLabels boolean. |
void |
redraw()
Call this instead of paint so that the repaintEnabled flag can be checked. |
void |
redraw(boolean redrawLabels)
Does nothing. |
void |
redrawLabels()
Does nothing. |
void |
setAutomatic(boolean automatic)
Sets the automatic Boolean for this tick object. |
void |
setDrawLabels(boolean drawLabels)
Sets the Boolean controlling the drawing of labels.True means draw the labels, false means hide the labels. |
void |
setDrawTicks(boolean drawTicks)
Sets the Boolean controlling the drawing of ticks.True means draw the ticks, false means hide the ticks. |
void |
setFontColor(Color fontColor)
Sets the color of the font labeling ticks. |
void |
setIncrementValue(double incrementValue)
In non-automatic mode, uses this value as the increment value, that is, places ticks at every incrementValue along the scale. |
void |
setInnerExtent(double innerExtent)
Sets the percentage of the scale's radius (as a decimal) at at which to begin drawing ticks radially outward. |
void |
setLabelExtent(double labelExtent)
Sets the percentage, expressed as a decimal fraction of the scale's radius, at which to place the center of the tick label objects. |
void |
setLabelGenerator(JCLabelGenerator labelGenerator)
Sets the label generator associated with this tick. |
void |
setOuterExtent(double outerExtent)
Sets the percentage of the scale's radius (as a decimal) at which to stop drawing the ticks. |
void |
setPrecision(int precision)
Sets the format for numbers in a tick label: positive values denote the number of places after the decimal point (for example, 3 means multiples of 0.001); negative values indicate the positive number of zeros are used before the decimal place (for example, -3 means numbering will be in multiples of 1000). |
void |
setPrecisionUseDefault(boolean precisionUseDefault)
If true, uses gauge-determined precision for tick labels, otherwise uses setPrecision to label tick marks. |
void |
setStartValue(double startValue)
In non-automatic mode, uses this value as the start value. |
void |
setStopValue(double stopValue)
In non-automatic mode, uses this value as the stop value. |
void |
setTickColor(Color tickColor)
Sets the color in which to draw ticks. |
void |
setTickStyle(JCTickStyle tickStyle)
Sets the JCTickStyle controlling the shape of the tick. |
void |
setTickWidth(double tickWidth)
Sets the width in pixels of the tick mark. |
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 JCCircularScale scale
protected boolean automatic
automatic
boolean determines whether tick increments are calculated automatically
or set by the incrementValue
property.
If true, tick increments are calculated by the gauge.
If false, the incrementValue
property is used to set the tick spacing.protected double startValue
startValue
is the scale value at which to begin this set oftick marks.protected double stopValue
stopValue
is the scale value at which this set of tick marks ends.protected double incrementValue
protected boolean precisionUseDefault
protected int precision
protected double tickWidth
protected boolean drawLabels
protected boolean drawTicks
protected double labelExtent
protected double innerExtent
protected double outerExtent
protected Color tickColor
protected JCTickStyle tickStyle
JCTickStyle
controlling the shape of the tick.protected Color fontColor
protected JCLabelGenerator labelGenerator
Constructor Detail |
public JCTick(JCCircularScale scale, double startValue, double stopValue)
scale
- The associated circular scalestartValue
- Where the tick marks are to beginstopValue
- Where the tick marks are to endpublic JCTick(JCCircularScale scale, boolean automatic, double startValue, double stopValue, double incrementValue, boolean precisionUseDefault, int precision, double tickWidth, boolean drawLabels, boolean drawTicks, double labelExtent, double innerExtent, double outerExtent, Color tickColor, JCTickStyle tickStyle, Font font, Color fontColor)
scale
- The associated circular scaleautomatic
- Whether to use automatic tick spacing or use
incrementValue as the tick spacingstartValue
- Where the tick marks are to beginstopValue
- Where the tick marks are to endincrementValue
- I automatic
is false, this sets the tick
interval.precisionUseDefault
- Sets whether tick labels use a default
precision, or use precision
.precision
- If precisionUseDefault
is false, use this
value to determine the precision of tick labels.tickWidth
- The width of a tick markdrawLabels
- Whether tick labels are to be drawndrawTicks
- Whether tick marks are to be drawnlabelExtent
- The radial distance to the center of a tick label,
expressed as a decimal fraction of the scale's radiusinnerExtent
- outerExtent
- The place where the tick mark endstickColor
- The color of the tick marktickStyle
- A JCTickStyle
enumfont
- The font for tick labelsfontColor
- The tick label's colorMethod Detail |
public void paintChildren(Graphics g)
drawLabels
boolean.g
- protected void calcTicks(Graphics g)
g
- The graphics used to get font metric information.protected void calcPrecision(double min, double max)
useDefaultPrecision
is set to true.min
- max
- public static double niceNum(double x, int exp, boolean round)
x
- exp
- round
- public JCLabelGenerator getLabelGenerator()
JComponent
which will be the label for a tick mark.public void setLabelGenerator(JCLabelGenerator labelGenerator)
JComponent
which will be the label for a tick mark.
See the code in
StopWatchExample.java for an example.labelGenerator
- The labelGenerator which implements the
JCLabelGeneratorInterface
public JCCircularScale getScale()
public boolean getAutomatic()
automatic
Boolean for this tick object.startValue
, stopValue
and
incrementValue
are used to lay out ticks.public void setAutomatic(boolean automatic)
automatic
Boolean for this tick object.automatic
- The automatic setting for this tick, true means ticks and
increments are dynamically determined by the gauge. Otherwise,
startValue
, stopValue
and
incrementValue
are used to lay out ticks.public double getStartValue()
public void setStartValue(double startValue)
startValue
- The startValuepublic double getStopValue()
public void setStopValue(double stopValue)
stopValue
- The stopValuepublic double getIncrementValue()
incrementValue
along the scale.public void setIncrementValue(double incrementValue)
incrementValue
along the scale.incrementValue
- The spacing between adjacent tick markspublic boolean getPrecisionUseDefault()
setPrecision
to label tick marks.setPrecision
.public void setPrecisionUseDefault(boolean precisionUseDefault)
setPrecision
to label tick marks.precisionUseDefault
- public int getPrecision()
precisionUseDefault
is set to true.public void setPrecision(int precision)
precisionUseDefault
is set to true.precision
- An integerpublic double getTickWidth()
public void setTickWidth(double tickWidth)
tickWidth
- The width of the tick to be drawn in pixelspublic boolean getDrawLabels()
public void setDrawLabels(boolean drawLabels)
drawLabels
- the boolean controlling the drawing of labels.public boolean getDrawTicks()
public void setDrawTicks(boolean drawTicks)
drawTicks
- the boolean controlling the drawing of ticks.public double getLabelExtent()
public void setLabelExtent(double labelExtent)
labelExtent
- public double getInnerExtent()
public void setInnerExtent(double innerExtent)
innerExtent
- The inner extent of the tick markpublic double getOuterExtent()
public void setOuterExtent(double outerExtent)
outerExtent
- The outerExtent of the tick markpublic Color getTickColor()
public void setTickColor(Color tickColor)
tickColor
- The color of the tick markpublic JCTickStyle getTickStyle()
JCTickStyle
controlling the shape of the tick.JCTickStyle
public void setTickStyle(JCTickStyle tickStyle)
JCTickStyle
controlling the shape of the tick.
Users may define their own tick style, if desired.tickStyle
- One of the built-in tick styles, or a user-supplied styleJCTickStyle
public Color getFontColor()
public void setFontColor(Color fontColor)
fontColor
- The font colorpublic void redraw(boolean redrawLabels)
public void redraw()
public void redrawLabels()
|
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 |