JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.swing.gauge
Class JCLinearTick

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.klg.jclass.swing.gauge.JCAbstractTick
                          |
                          +--com.klg.jclass.swing.gauge.JCLinearTick
All Implemented Interfaces:
ImageObserver, JCTick, MenuContainer, Serializable

public class JCLinearTick
extends JCAbstractTick

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

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
JCLinearTick(com.klg.jclass.swing.gauge.JCLinearScale scale)
          Creates a JCLinearTick that spans its linear scale.
JCLinearTick(com.klg.jclass.swing.gauge.JCLinearScale scale, boolean automatic, double startValue, double stopValue, double incrementValue, boolean precisionUseDefault, int precision, double width, boolean drawLabels, boolean visible, double labelExtent, double innerExtent, double outerExtent, Color foreground, com.klg.jclass.swing.gauge.JCTickStyle style, Font font, Color fontColor)
          Creates a linear tick object.
 
Method Summary
 void calcLinearTicks(Graphics g)
          If automatic, this method is called to determine and set the start/stop and increment values for laying out ticks.
protected  com.klg.jclass.swing.gauge.JCLinearScale getLinearScale()
          Returns the linear scale associated with this tick object.
 Dimension getPreferredSize()
          This is called by our widget parent when it wants to know our preferred size.
 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

JCLinearTick

public JCLinearTick(com.klg.jclass.swing.gauge.JCLinearScale scale)
Creates a JCLinearTick that spans its linear scale. Other tick properties have default values.

Parameters:
scale - the JCLinearScale for which these ticks are drawn

JCLinearTick

public JCLinearTick(com.klg.jclass.swing.gauge.JCLinearScale scale,
                    boolean automatic,
                    double startValue,
                    double stopValue,
                    double incrementValue,
                    boolean precisionUseDefault,
                    int precision,
                    double width,
                    boolean drawLabels,
                    boolean visible,
                    double labelExtent,
                    double innerExtent,
                    double outerExtent,
                    Color foreground,
                    com.klg.jclass.swing.gauge.JCTickStyle style,
                    Font font,
                    Color fontColor)
Creates a linear tick object.

Parameters:
scale - the associated linear scale
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 - where the tick marks are to begin
stopValue - where the tick marks are to end
incrementValue - the tick interval
precisionUseDefault - 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), 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 - each tick's width in pixels
drawLabels - whether to draw labels or not
visible - Are the ticks visible?
labelExtent - each label's extent expressed as a ratio of its distance from the top or left of the scale to the width or height of the scale
innerExtent - the tick's inner_extent, expressed as a ratio of its distance from the top or left to the width or height of the scale
outerExtent - the tick's outer_extent, expressed as a ratio of its distance from the top or left to the width or height of the scale
foreground - the tick's color
style - the type of tick; valid values are DIAMOND, TRIANGLE, REVERSE_TRIANGLE, RECTANGLE, LINE, and CIRCLE.
font - the font used to draw tick labels
fontColor - the color of the font for tick labels
Method Detail

getLinearScale

protected com.klg.jclass.swing.gauge.JCLinearScale getLinearScale()
Returns the linear scale associated with this tick object.

Returns:
the linear scale associated with this tick object

getPreferredSize

public Dimension getPreferredSize()
This is called by our widget parent when it wants to know our preferred size.

Overrides:
getPreferredSize in class JComponent
Returns:
the Dimension (size) we'd like to be based on our associated linear scale

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)

calcLinearTicks

public void calcLinearTicks(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 -

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.