JClass DesktopViews 6.3.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.JCAbstractTick
                          |
                          +--com.klg.jclass.swing.gauge.JCCircularTick
All Implemented Interfaces:
ImageObserver, JCTick, MenuContainer, Serializable

public class JCCircularTick
extends JCAbstractTick
implements Serializable

The class for tick marks that are drawn on a JCCircularScale.

See Also:
Serialized Form

Nested 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
 
Fields inherited from class com.klg.jclass.swing.gauge.JCAbstractTick
automatic, drawLabels, drawTicks, fontColor, incrementValue, innerExtent, labelExtent, labelGenerator, outerExtent, precision, precisionUseDefault, reversed, 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
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
JCCircularTick(com.klg.jclass.swing.gauge.JCCircularScale scale)
          Creates a JCCircularTick that spans its circular scale.
JCCircularTick(com.klg.jclass.swing.gauge.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, com.klg.jclass.swing.gauge.JCTickStyle style, Font font, Color fontColor)
          Creates a JCCircularTick by specifying its properties.
 
Method Summary
 void calcCircularTicks(Graphics g)
          If automatic, this method is called to determine and set the start/stop and increment values for laying out ticks.
 com.klg.jclass.swing.gauge.JCCircularScale getCircularScale()
          Returns the circular scale associated with this tick object.
 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.JCAbstractTick
calcPrecision, calcTicks, getAutomatic, getDrawLabels, getDrawTicks, getFontColor, getIncrementValue, getInnerExtent, getLabelExtent, getLabelGenerator, getOuterExtent, getPrecision, getPrecisionUseDefault, getScale, getStartValue, getStopValue, getTickColor, getTickStyle, getTickWidth, isReversed, niceNum, paintChildren, redraw, setAutomatic, setDrawLabels, setDrawTicks, setFontColor, setIncrementValue, setInnerExtent, setLabelExtent, setLabelGenerator, setOuterExtent, setPrecision, setPrecisionUseDefault, setReversed, setStartValue, setStopValue, setTickColor, setTickStyle, setTickWidth
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getAccessibleContext, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPropertyChangeListeners, getPropertyChangeListeners, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getUIClassID, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isPreferredSizeSet, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintImmediately, paintImmediately, paramString, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFont, setForeground, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update, updateUI
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JCCircularTick

public JCCircularTick(com.klg.jclass.swing.gauge.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(com.klg.jclass.swing.gauge.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,
                      com.klg.jclass.swing.gauge.JCTickStyle style,
                      Font font,
                      Color fontColor)
Creates a JCCircularTick by specifying its properties.

Parameters:
scale - the JCCircularScale for which these ticks are drawn
automatic - whether to automatically calculate the tick start, stop, and increment values from the scale's min and max, or to use the provided values
startValue - the value on the scale where these ticks start
stopValue - the value on the scale where these ticks end
incrementValue - the tick interval
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 - if true, draw labels for each tick; if false, do not draw labels
drawTicks - if true, draw ticks; if false, do not 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; valid values are DIAMOND, TRIANGLE, REVERSE_TRIANGLE, RECTANGLE, LINE, and CIRCLE. You can also create your own JCTickStyle.
font - the font used to draw tick labels
fontColor - the color of the font for tick labels
Method Detail

getCircularScale

public com.klg.jclass.swing.gauge.JCCircularScale getCircularScale()
Returns the circular scale associated with this tick object.

Returns:
the circualr scale associated with this tick object

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. Moves and resizes this component.

Overrides:
reshape in class JComponent
Parameters:
x - the new horizontal location
y - the new vertical location
w - the new width
h - the new height
See Also:
Component.setBounds(int, int, int, int)

calcCircularTicks

public void calcCircularTicks(Graphics g)
If 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.

Parameters:
g - the graphics used to get font metric information

redrawLabels

public void redrawLabels()
Layout and redraw labels.

Overrides:
redrawLabels in class JCAbstractTick

paintComponent

public void paintComponent(Graphics g)
Main tick draw routine.

Overrides:
paintComponent in class JComponent
Parameters:
g - The graphics object with which to draw

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 JCAbstractTick
Parameters:
redrawLabels - true means reposition and redraw the labels; otherwise, just repaint the component

Copyright © 2004 Quest Software Inc..
All rights reserved.