JClass 4.5.0 API
Documentation

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

Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
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
 
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
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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

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 drawn
automatic - A Boolean, true means calculate ticks, false means use supplied increment value
startValue - The value on the scale where these ticks start
stopValue - The value on the scale where these ticks end
incrementValue - If not automatic, ticks are placed at an increment distance from each other
precisionUseDefault - 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 drawn
drawLabels - True means draw labels for each tick, false means don't
drawTicks - True means draw ticks, false means don't draw ticks (you may want only the labels
labelExtent - 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 center
innerExtent - 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 outerExtent
outerExtent - 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 center
tickColor - The color the tick is drawn in
style - The JCTickStyle that defines the shape of the tick
font - The font used to draw tick labels
fontColor - The color of the font for tick labels
Method Detail

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 draw
angle - The angle at which this tick will be drawn
scaledInnerExtent - The actual inner extent
scaledOuterExtent - 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

Copyright© 1999-2000 KL Group Inc.
All rights reserved.