|
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.JCAbstractTick
A graduated scale marker object. It comprises a set of uniformly spaced tick marks.
JCAbstractTick
,
Serialized FormNested Class Summary |
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 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, no tick labels are drawn. |
protected boolean |
drawTicks
If true , draw tick marks; otherwise, no tick marks are drawn. |
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 com.klg.jclass.swing.gauge.JCLabelGenerator |
labelGenerator
A custom label generator. |
protected double |
outerExtent
The percentage of the scale's radius or width/height (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 boolean |
reversed
Asks: "Is the tick reversed?". |
protected com.klg.jclass.swing.gauge.JCScale |
scale
The scale associated with this tick object. |
protected double |
startValue
The startValue is the scale value at which to begin this set of
tick 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 com.klg.jclass.swing.gauge.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 |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
JCAbstractTick(com.klg.jclass.swing.gauge.JCScale 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,
com.klg.jclass.swing.gauge.JCTickStyle tickStyle,
Font font,
Color fontColor)
Creates a tick object and sets its properties. |
|
JCAbstractTick(com.klg.jclass.swing.gauge.JCScale scale,
double startValue,
double stopValue)
Creates ticks. |
Method Summary | |
protected void |
calcPrecision(double min,
double max)
Determines and sets a "nice" precision to use if useDefaultPrecision is set to true . |
protected void |
calcTicks(Graphics g,
int width)
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, use this value as the increment value. |
double |
getInnerExtent()
Returns the percentage of the scale's radius (as a decimal) at which to begin drawing ticks radially outward. |
double |
getLabelExtent()
Returns the position, expressed as a decimal fraction of the scale's size, where tick labels are placed (the size is the scale's radius or its width/height, depending on the linear scale's orientation). |
com.klg.jclass.swing.gauge.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 the current value of precision property to
label tick marks. |
com.klg.jclass.swing.gauge.JCScale |
getScale()
Returns the scale associated with this tick. |
double |
getStartValue()
In non-automatic mode, use this value as the start value. |
double |
getStopValue()
In non-automatic mode, use this value as the stop value. |
Color |
getTickColor()
Returns the color in which to draw ticks. |
com.klg.jclass.swing.gauge.JCTickStyle |
getTickStyle()
Returns the JCTickStyle controlling the shape of the tick. |
double |
getTickWidth()
Returns the width in pixels of the tick mark. |
boolean |
isReversed()
Asks: "Is the tick reversed?". |
static double |
niceNum(double x,
int exp,
boolean round)
Given x, nudges 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. |
void |
setDrawTicks(boolean drawTicks)
Sets the Boolean controlling the drawing of ticks. |
void |
setFontColor(Color fontColor)
Sets the color of the font labeling ticks. |
void |
setIncrementValue(double incrementValue)
In non-automatic mode, use this value as the increment value. |
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 size, at which to place the center of the tick label objects. |
void |
setLabelGenerator(com.klg.jclass.swing.gauge.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 the gauge-determined precision for tick labels;
otherwise, uses the current value of precision property to
label tick marks. |
void |
setReversed(boolean reversed)
Sets the reversed property of the tick. |
void |
setStartValue(double startValue)
In non-automatic mode, use this value as the start value. |
void |
setStopValue(double stopValue)
In non-automatic mode, use this value as the stop value. |
void |
setTickColor(Color tickColor)
Sets the color in which to draw ticks. |
void |
setTickStyle(com.klg.jclass.swing.gauge.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.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected com.klg.jclass.swing.gauge.JCScale 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 of
tick marks.
protected double stopValue
stopValue
is the scale value at which this set of tick
marks ends.
protected double incrementValue
protected boolean precisionUseDefault
true
, use gauge-determined precision. If false
,
use the precision property to determine the number of decimal places on tick
labels.
protected int precision
precisionUseDefault
is false
, use this
precision. If it is true
, the value of this property will be
automatically calculated and the calculated value will overwrite any
previous value this property might have.
protected double tickWidth
protected boolean reversed
protected boolean drawLabels
true
, draw tick labels; otherwise, no tick labels are drawn.
protected boolean drawTicks
true
, draw tick marks; otherwise, no tick marks are drawn.
protected double labelExtent
protected double innerExtent
protected double outerExtent
protected Color tickColor
protected com.klg.jclass.swing.gauge.JCTickStyle tickStyle
JCTickStyle
controlling the shape of the tick.
protected Color fontColor
protected com.klg.jclass.swing.gauge.JCLabelGenerator labelGenerator
Constructor Detail |
public JCAbstractTick(com.klg.jclass.swing.gauge.JCScale scale, double startValue, double stopValue)
startValue
, and stopValue
need to be supplied. The other properties take on their default values.
scale
- the associated circular scalestartValue
- where the tick marks are to beginstopValue
- where the tick marks are to endpublic JCAbstractTick(com.klg.jclass.swing.gauge.JCScale 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, com.klg.jclass.swing.gauge.JCTickStyle tickStyle, Font font, Color fontColor)
scale
- the associated circular or linear scaleautomatic
- whether to automatically calculate the tick start, stop,
and increment values from the scale's min and max, or to use the
provided valuesstartValue
- where the tick marks are to beginstopValue
- where the tick marks are to endincrementValue
- the tick intervalprecisionUseDefault
- sets whether tick labels use a default
precision, or use precision
precision
- The format of the tick label; positive values denote the
number of places after the decimal point (for example, 3 means multiples
of 0.001), and negative values indicate the positive number of zeros to
be used before the decimal place (for example, -3 means numbering will
be in multiples of 1000). Overridden if precisionUseDefault
is set to true
.tickWidth
- the width of a tick markdrawLabels
- whether tick labels are to be drawndrawTicks
- whether tick marks are to be drawnlabelExtent
- the radial or linear distance to the center of a tick
label, expressed as a decimal fraction of the scale's radius or
width/heightinnerExtent
- the place where the tick mark starts, expressed as a
decimal fraction of the scale's radius or width/heightouterExtent
- the place where the tick mark ends, expressed as a
decimal fraction of the scale's radius or width/heighttickColor
- 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.
paintChildren
in class JComponent
g
- protected void calcTicks(Graphics g, int width)
automatic
, this method is called to determine and
set the start/stop and increment values for laying out ticks.
The goal is to have as many ticks/labels as will fit without
the ticks or labels overlapping.
g
- the graphics used to get font metric informationwidth
- width in pixels to lay out ticksprotected void calcPrecision(double min, double max)
useDefaultPrecision
is set to true
.
min
- max
- public static double niceNum(double x, int exp, boolean round)
default_precision
.
x
- exp
- round
-
public com.klg.jclass.swing.gauge.JCScale getScale()
getScale
in interface JCTick
JCAbstractTick
componentpublic com.klg.jclass.swing.gauge.JCLabelGenerator getLabelGenerator()
JComponent
which will be the label for a tick mark.
getLabelGenerator
in interface JCTick
labelGenerator
public void setLabelGenerator(com.klg.jclass.swing.gauge.JCLabelGenerator labelGenerator)
JComponent
which will be the label for a tick mark.
See the code in examples.elements.StopWatchExample for an example.
setLabelGenerator
in interface JCTick
labelGenerator
- the labelGenerator
which implements the
JCLabelGenerator
interfacepublic boolean getAutomatic()
automatic
Boolean for this tick object.
getAutomatic
in interface JCTick
true
means
ticks and increments are dynamically determined by the gauge; otherwise,
startValue
, stopValue
, and
incrementValue
are used to lay out tickspublic void setAutomatic(boolean automatic)
automatic
Boolean for this tick object.
setAutomatic
in interface JCTick
automatic
- the automatic setting for this tick, where 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()
getStartValue
in interface JCTick
startValue
public void setStartValue(double startValue)
setStartValue
in interface JCTick
startValue
- the start valuepublic double getStopValue()
getStopValue
in interface JCTick
stopValue
public void setStopValue(double stopValue)
setStopValue
in interface JCTick
stopValue
- the stop valuepublic double getIncrementValue()
incrementValue
along the scale.
In automatic mode, the calculated increment value will overwrite this value.
getIncrementValue
in interface JCTick
public void setIncrementValue(double incrementValue)
incrementValue
along the scale.
In automatic mode, the calculated increment value will overwrite this value.
setIncrementValue
in interface JCTick
incrementValue
- the spacing between adjacent tick markspublic boolean getPrecisionUseDefault()
true
, uses gauge-determined precision for tick labels;
otherwise, uses the current value of precision
property to
label tick marks.
getPrecisionUseDefault
in interface JCTick
precision
propertypublic void setPrecisionUseDefault(boolean precisionUseDefault)
true
, uses the gauge-determined precision for tick labels;
otherwise, uses the current value of precision
property to
label tick marks.
setPrecisionUseDefault
in interface JCTick
precisionUseDefault
- public int getPrecision()
precisionUseDefault
is set
to true
.
getPrecision
in interface JCTick
public void setPrecision(int precision)
precisionUseDefault
is set
to true
.
setPrecision
in interface JCTick
precision
- an integerpublic double getTickWidth()
getTickWidth
in interface JCTick
public void setTickWidth(double tickWidth)
setTickWidth
in interface JCTick
tickWidth
- the width in pixels of the tick to be drawnpublic boolean isReversed()
isReversed
in interface JCTick
public void setReversed(boolean reversed)
setReversed
in interface JCTick
reversed
- is the tick's direction reversed?public boolean getDrawLabels()
True
means draw the labels, false
means hide the labels.
getDrawLabels
in interface JCTick
public void setDrawLabels(boolean drawLabels)
True
means draw the labels, false
means hide the labels.
setDrawLabels
in interface JCTick
drawLabels
- the boolean controlling the drawing of labelspublic boolean getDrawTicks()
True
means draw the ticks, false
means hide the ticks.
getDrawTicks
in interface JCTick
public void setDrawTicks(boolean drawTicks)
True
means draw the ticks, false
means hide the ticks.
setDrawTicks
in interface JCTick
drawTicks
- the boolean controlling the drawing of tickspublic double getLabelExtent()
getLabelExtent
in interface JCTick
public void setLabelExtent(double labelExtent)
setLabelExtent
in interface JCTick
labelExtent
- public double getInnerExtent()
getInnerExtent
in interface JCTick
public void setInnerExtent(double innerExtent)
setInnerExtent
in interface JCTick
innerExtent
- the inner extent of the tick markpublic double getOuterExtent()
getOuterExtent
in interface JCTick
outerExtent
of the tick markpublic void setOuterExtent(double outerExtent)
setOuterExtent
in interface JCTick
outerExtent
- the outerExtent
of the tick markpublic Color getTickColor()
getTickColor
in interface JCTick
public void setTickColor(Color tickColor)
setTickColor
in interface JCTick
tickColor
- the color of the tick markpublic com.klg.jclass.swing.gauge.JCTickStyle getTickStyle()
JCTickStyle
controlling the shape of the tick.
getTickStyle
in interface JCTick
JCTickStyle
public void setTickStyle(com.klg.jclass.swing.gauge.JCTickStyle tickStyle)
JCTickStyle
controlling the shape of the tick.
Users may define their own tick style, if desired.
setTickStyle
in interface JCTick
tickStyle
- one of the built-in tick styles, or a user-supplied styleJCTickStyle
public Color getFontColor()
getFontColor
in interface JCTick
public void setFontColor(Color fontColor)
setFontColor
in interface JCTick
fontColor
- the font colorpublic void redraw(boolean redrawLabels)
JCCircularTick
or
JCLinearTick
.
redrawLabels
- public void redraw()
repaintEnabled
flag can
be checked. No repaint will occur if that flag is false
.
public void redrawLabels()
JCCircularTick
or
JCLinearTick
.
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |