com.klg.jclass.swing.gauge
Class JCCircularTick
java.lang.Object
|
+--java.awt.Component
|
+--java.awt.Container
|
+--javax.swing.JComponent
|
+--com.klg.jclass.swing.gauge.JCTick
|
+--com.klg.jclass.swing.gauge.JCCircularTick
- public class JCCircularTick
- extends JCTick
- implements Serializable
The class for tick marks that are drawn on a JCCircularScale
.
- See Also:
- Serialized Form
Fields inherited from class com.klg.jclass.swing.gauge.JCTick |
automatic,
drawLabels,
drawTicks,
fontColor,
incrementValue,
innerExtent,
labelExtent,
labelGenerator,
outerExtent,
precision,
precisionUseDefault,
scale,
startValue,
stopValue,
tickColor,
tickStyle,
tickWidth |
Constructor Summary |
JCCircularTick(JCCircularScale scale)
Creates a JCCircularTick that spans its circular scale. |
JCCircularTick(JCCircularScale scale,
boolean automatic,
double startValue,
double stopValue,
double incrementValue,
boolean precisionUseDefault,
int precision,
double width,
boolean drawLabels,
boolean drawTicks,
double labelExtent,
double innerExtent,
double outerExtent,
Color tickColor,
JCTickStyle style,
Font font,
Color fontColor)
Creates a JCCircularTick by specifying its properties. |
Method Summary |
protected void |
drawTick(Graphics g,
double angle,
double scaledInnerExtent,
double scaledOuterExtent)
Draws a polygon tick mark (circle, triangle, diamond or user-defined). |
Dimension |
getPreferredSize()
|
void |
paintComponent(Graphics g)
Main tick draw routine. |
void |
redraw(boolean redrawLabels)
Call this instead of paint so that the repaintEnabled flag can
be checked. |
void |
redrawLabels()
Layout and redraw labels. |
void |
reshape(int x,
int y,
int w,
int h)
Overridden to preserve the layout of labels on a resize. |
Methods inherited from class com.klg.jclass.swing.gauge.JCTick |
calcPrecision,
calcTicks,
getAutomatic,
getDrawLabels,
getDrawTicks,
getFontColor,
getIncrementValue,
getInnerExtent,
getLabelExtent,
getLabelGenerator,
getOuterExtent,
getPrecision,
getPrecisionUseDefault,
getScale,
getStartValue,
getStopValue,
getTickColor,
getTickStyle,
getTickWidth,
niceNum,
paintChildren,
redraw,
setAutomatic,
setDrawLabels,
setDrawTicks,
setFontColor,
setIncrementValue,
setInnerExtent,
setLabelExtent,
setLabelGenerator,
setOuterExtent,
setPrecision,
setPrecisionUseDefault,
setStartValue,
setStopValue,
setTickColor,
setTickStyle,
setTickWidth |
Methods inherited from class javax.swing.JComponent |
addAncestorListener,
addNotify,
addPropertyChangeListener,
addPropertyChangeListener,
addVetoableChangeListener,
computeVisibleRect,
contains,
createToolTip,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
firePropertyChange,
fireVetoableChange,
getAccessibleContext,
getActionForKeyStroke,
getAlignmentX,
getAlignmentY,
getAutoscrolls,
getBorder,
getBounds,
getClientProperty,
getComponentGraphics,
getConditionForKeyStroke,
getDebugGraphicsOptions,
getGraphics,
getHeight,
getInsets,
getInsets,
getLocation,
getMaximumSize,
getMinimumSize,
getNextFocusableComponent,
getRegisteredKeyStrokes,
getRootPane,
getSize,
getToolTipLocation,
getToolTipText,
getToolTipText,
getTopLevelAncestor,
getUIClassID,
getVisibleRect,
getWidth,
getX,
getY,
grabFocus,
hasFocus,
isDoubleBuffered,
isFocusCycleRoot,
isFocusTraversable,
isLightweightComponent,
isManagingFocus,
isOpaque,
isOptimizedDrawingEnabled,
isPaintingTile,
isRequestFocusEnabled,
isValidateRoot,
paint,
paintBorder,
paintImmediately,
paintImmediately,
paramString,
processComponentKeyEvent,
processFocusEvent,
processKeyEvent,
processMouseMotionEvent,
putClientProperty,
registerKeyboardAction,
registerKeyboardAction,
removeAncestorListener,
removeNotify,
removePropertyChangeListener,
removePropertyChangeListener,
removeVetoableChangeListener,
repaint,
repaint,
requestDefaultFocus,
requestFocus,
resetKeyboardActions,
revalidate,
scrollRectToVisible,
setAlignmentX,
setAlignmentY,
setAutoscrolls,
setBackground,
setBorder,
setDebugGraphicsOptions,
setDoubleBuffered,
setEnabled,
setFont,
setForeground,
setMaximumSize,
setMinimumSize,
setNextFocusableComponent,
setOpaque,
setPreferredSize,
setRequestFocusEnabled,
setToolTipText,
setUI,
setVisible,
unregisterKeyboardAction,
update,
updateUI |
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.awt.Component |
action,
add,
addComponentListener,
addFocusListener,
addInputMethodListener,
addKeyListener,
addMouseListener,
addMouseMotionListener,
bounds,
checkImage,
checkImage,
coalesceEvents,
contains,
createImage,
createImage,
disable,
disableEvents,
dispatchEvent,
enable,
enable,
enableEvents,
enableInputMethods,
getBackground,
getBounds,
getColorModel,
getComponentOrientation,
getCursor,
getDropTarget,
getFont,
getFontMetrics,
getForeground,
getInputContext,
getInputMethodRequests,
getLocale,
getLocation,
getLocationOnScreen,
getName,
getParent,
getPeer,
getSize,
getToolkit,
getTreeLock,
gotFocus,
handleEvent,
hide,
imageUpdate,
inside,
isDisplayable,
isEnabled,
isLightweight,
isShowing,
isValid,
isVisible,
keyDown,
keyUp,
list,
list,
list,
location,
lostFocus,
mouseDown,
mouseDrag,
mouseEnter,
mouseExit,
mouseMove,
mouseUp,
move,
nextFocus,
paintAll,
postEvent,
prepareImage,
prepareImage,
printAll,
processComponentEvent,
processInputMethodEvent,
processMouseEvent,
remove,
removeComponentListener,
removeFocusListener,
removeInputMethodListener,
removeKeyListener,
removeMouseListener,
removeMouseMotionListener,
repaint,
repaint,
repaint,
resize,
resize,
setBounds,
setBounds,
setComponentOrientation,
setDropTarget,
setLocale,
setLocation,
setLocation,
setName,
setSize,
setSize,
show,
show,
size,
toString,
transferFocus |
JCCircularTick
public JCCircularTick(JCCircularScale scale)
- Creates a
JCCircularTick
that spans its circular scale. Other tick properties have default values.
- Parameters:
scale
- The JCCircularScale
for which these ticks are
drawn
JCCircularTick
public JCCircularTick(JCCircularScale scale,
boolean automatic,
double startValue,
double stopValue,
double incrementValue,
boolean precisionUseDefault,
int precision,
double width,
boolean drawLabels,
boolean drawTicks,
double labelExtent,
double innerExtent,
double outerExtent,
Color tickColor,
JCTickStyle style,
Font font,
Color fontColor)
- Creates a
JCCircularTick
by specifying its properties.
- Parameters:
scale
- The JCCircularScale
for which these ticks are
drawnautomatic
- A Boolean, true means calculate ticks, false means use
supplied increment valuestartValue
- The value on the scale where these ticks startstopValue
- The value on the scale where these ticks endincrementValue
- If not automatic, ticks are placed at an
increment distance from each otherprecisionUseDefault
- If true, gauge will determine an appropriate
precision automatically, if false, "precision" will be used.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); 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.width
- The width of the tick to be drawndrawLabels
- True means draw labels for each tick, false means don'tdrawTicks
- True means draw ticks, false means don't draw ticks (you
may want only the labelslabelExtent
- A ratio of the radius at which the label will be drawn,
for example, 0.8 means draw labels 80% of the radius size away from the
centerinnerExtent
- The inner extent of each tick drawn as a ratio of the
radius size, for example, 0.8 means the tick will start at 80% of the
radius size away from the center and be drawn to outerExtentouterExtent
- The outer extent of each tick drawn as a ratio of the
radius size, for example, 1.1 means start at inner extent and draw to a
location 110% the size of the radius away from the centertickColor
- The color the tick is drawn instyle
- The JCTickStyle
that defines the shape of the
tickfont
- The font used to draw tick labelsfontColor
- The color of the font for tick labels
getPreferredSize
public Dimension getPreferredSize()
- Overrides:
- getPreferredSize in class JComponent
reshape
public void reshape(int x,
int y,
int w,
int h)
- Overridden to preserve the layout of labels on a resize.
- Overrides:
- reshape in class JComponent
- Parameters:
x
- y
- w
- h
-
redrawLabels
public void redrawLabels()
- Layout and redraw labels.
- Overrides:
- redrawLabels in class JCTick
drawTick
protected void drawTick(Graphics g,
double angle,
double scaledInnerExtent,
double scaledOuterExtent)
- Draws a polygon tick mark (circle, triangle, diamond or user-defined).
- Parameters:
g
- The graphics context on which to drawangle
- The angle at which this tick will be drawnscaledInnerExtent
- The actual inner extentscaledOuterExtent
- The actual outer extent
paintComponent
public void paintComponent(Graphics g)
- Main tick draw routine.
- Overrides:
- paintComponent in class JComponent
- Parameters:
g
-
redraw
public void redraw(boolean redrawLabels)
- Call this instead of paint so that the repaintEnabled flag can
be checked. No repaint will occur if that flag is false.
- Overrides:
- redraw in class JCTick
- Parameters:
redrawLabels
- true means reposition and redraw the labels, otherwise
just repaint the component