JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.swing.gauge
Class JCAbstractIndicator

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.klg.jclass.swing.gauge.JCAbstractIndicator
All Implemented Interfaces:
ImageObserver, JCIndicator, MenuContainer, Serializable
Direct Known Subclasses:
JCAbstractNeedle, JCCircularIndicator, JCLinearIndicator

public abstract class JCAbstractIndicator
extends JComponent
implements JCIndicator

An indicator points to a particular value on its associated scale. There may be multiple indicators associated with a scale.

See Also:
JCIndicatorStyle, 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
protected  com.klg.jclass.swing.gauge.JCIndicatorStyle indicatorStyle
          The indicator style, one of: JCIndicatorStyle.ARROW JCIndicatorStyle.CIRCLE JCIndicatorStyle.POINTER JCIndicatorStyle.RECTANGLE JCIndicatorStyle.TRIANGLE JCIndicatorStyle.TAILED_ARROW JCIndicatorStyle.TAILED_POINTER or a user-defined instance of the JCIndicatorStyle class.
protected  double indicatorWidth
          The indicator's width in pixels.
protected  double inner_extent
          The inner extent of the indicator as a ratio of the scale's radius.
protected  double outer_extent
          The outer extent of the indicator as a ratio of the scale's radius.
protected  boolean reversed
          Asks: "Is the indicator reversed?".
protected  com.klg.jclass.swing.gauge.JCScale scale
          The indicator's associated scale.
protected  double value
          The scale value at which this indicator should point.
 
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
JCAbstractIndicator(Color foreground, double indicatorWidth, com.klg.jclass.swing.gauge.JCScale scale, boolean visible, double inner_extent, double outer_extent, com.klg.jclass.swing.gauge.JCIndicatorStyle indicatorStyle, double value)
          Creates an indicator.
JCAbstractIndicator(com.klg.jclass.swing.gauge.JCScale scale)
          Creates a indicator given a scale.
 
Method Summary
 com.klg.jclass.swing.gauge.JCIndicatorStyle getIndicatorStyle()
          Returns the JCIndicatorStyle for this indicator.
 double getIndicatorWidth()
          Returns the indicator width in pixels.
 double getInnerExtent()
          Returns the inner extent of this indicator as a ratio of the scale's width, height, or radius (depending on the scale's type and orientation).
 double getOuterExtent()
          Returns the outer extent of this indicator as a ratio of the scale's width, height, or radius (depending on the scale's type and orientation).
 Dimension getPreferredSize()
          Returns the preferred size for this component.
 com.klg.jclass.swing.gauge.JCScale getScale()
          Returns the scale associated with this indicator.
 double getValue()
          Returns the scale value at which this indicator is currently pointing.
 boolean isReversed()
          Asks :"Is the indicator reversed?".
abstract  void paint(Graphics g)
          This routine actually draws the indicator object on the screen.
 void redraw()
          Call this instead of paint so that the repaintEnabled flag can be checked.
 void setIndicatorStyle(com.klg.jclass.swing.gauge.JCIndicatorStyle indicatorStyle)
          Sets the JCIndicatorStyle for this indicator.
 void setIndicatorWidth(double indicatorWidth)
          Sets the indicator width in pixels.
 void setInnerExtent(double inner_extent)
          Sets the inner extent of this indicator as a ratio of the scale's width, height, or radius (depending on the scale's type and orientation).
 void setOuterExtent(double outer_extent)
          Sets the outer extent of this indicator as a ratio of the scale's width, height, or radius (depending on the scale's type and orientation).
 void setReversed(boolean reversed)
          Sets the reversed property of the indicator.
protected  void setScale(com.klg.jclass.swing.gauge.JCScale scale)
          Sets the indicator's scale to the supplied value.
 void setValue(double value)
          Sets the scale value to which this indicator should point.
 
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, paintBorder, paintChildren, paintComponent, 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, reshape, 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
 

Field Detail

scale

protected com.klg.jclass.swing.gauge.JCScale scale
The indicator's associated scale.


indicatorWidth

protected double indicatorWidth
The indicator's width in pixels.


reversed

protected boolean reversed
Asks: "Is the indicator reversed?".


inner_extent

protected double inner_extent
The inner extent of the indicator as a ratio of the scale's radius.


outer_extent

protected double outer_extent
The outer extent of the indicator as a ratio of the scale's radius.


indicatorStyle

protected com.klg.jclass.swing.gauge.JCIndicatorStyle indicatorStyle
The indicator style, one of: or a user-defined instance of the JCIndicatorStyle class.


value

protected double value
The scale value at which this indicator should point.

Constructor Detail

JCAbstractIndicator

public JCAbstractIndicator(com.klg.jclass.swing.gauge.JCScale scale)
Creates a indicator given a scale. All other properties are at their default values (the value property takes on the scale's min value by default).

Parameters:
scale - the associated circular scale

JCAbstractIndicator

public JCAbstractIndicator(Color foreground,
                           double indicatorWidth,
                           com.klg.jclass.swing.gauge.JCScale scale,
                           boolean visible,
                           double inner_extent,
                           double outer_extent,
                           com.klg.jclass.swing.gauge.JCIndicatorStyle indicatorStyle,
                           double value)
Creates an indicator.

Parameters:
foreground - the indicator's color
indicatorWidth - the indicator's width in pixels
scale - the associated circular scale
visible - a Boolean that controls the visibility of the indicator
inner_extent - the indicator's inner_extent, expressed as a ratio of the indicator's inner position to the top or center of the associated scale
outer_extent - the indicator's outer_extent, expressed as a ratio of the indicator's outer position to the top or center of the associated scale
indicatorStyle - indicator styles are kept in JCIndicatorStyle; user-defined indicator styles may be passed to JCIndicatorStyle's constructor
value - the indicator's value; the indicator points to this value on its associated scale
Method Detail

getPreferredSize

public Dimension getPreferredSize()
Returns the preferred size for this component.

Overrides:
getPreferredSize in class JComponent
Returns:
the preferred size

paint

public abstract void paint(Graphics g)
This routine actually draws the indicator object on the screen.

Overrides:
paint in class JComponent
Parameters:
g -

getScale

public com.klg.jclass.swing.gauge.JCScale getScale()
Returns the scale associated with this indicator.

Specified by:
getScale in interface JCIndicator
Returns:
the scale for the JCAbstractIndicator component

setScale

protected void setScale(com.klg.jclass.swing.gauge.JCScale scale)
Sets the indicator's scale to the supplied value.

Parameters:
scale - the new scale

getValue

public double getValue()
Returns the scale value at which this indicator is currently pointing.

Specified by:
getValue in interface JCIndicator
Returns:
the current value pointed to by this indicator

setValue

public void setValue(double value)
Sets the scale value to which this indicator should point.

Specified by:
setValue in interface JCIndicator
Parameters:
value - the value at which to point

getInnerExtent

public double getInnerExtent()
Returns the inner extent of this indicator as a ratio of the scale's width, height, or radius (depending on the scale's type and orientation). For example, in the circular case, 0.75 means draw out to 75% of the scale's radius.

Specified by:
getInnerExtent in interface JCIndicator
Returns:
The inner_exent of this indicator as a ratio of the scale's width, height, or radius (depending on the scale's type and orientation)

setInnerExtent

public void setInnerExtent(double inner_extent)
Sets the inner extent of this indicator as a ratio of the scale's width, height, or radius (depending on the scale's type and orientation). For example, in the circular case, 0.75 means draw out to 75% of the scale's radius.

Specified by:
setInnerExtent in interface JCIndicator
Parameters:
inner_extent - the inner extent of this indicator as a ratio of the scale's width, height, or radius (depending on the scale's type and orientation)

getOuterExtent

public double getOuterExtent()
Returns the outer extent of this indicator as a ratio of the scale's width, height, or radius (depending on the scale's type and orientation). For example, in the circular case, 0.75 means draw out to 75% of the scale's radius.

Specified by:
getOuterExtent in interface JCIndicator
Returns:
The outer_exent of this indicator as a ratio of the scale's width, height, or radius (depending on the scale's type and orientation)

setOuterExtent

public void setOuterExtent(double outer_extent)
Sets the outer extent of this indicator as a ratio of the scale's width, height, or radius (depending on the scale's type and orientation). For example, in the circular case, 0.75 means draw out to 75% of the scale's radius.

Specified by:
setOuterExtent in interface JCIndicator
Parameters:
outer_extent - the outer extent of this indicator as a ratio of the scale's width, height, or radius (depending on the scale's type and orientation)

getIndicatorStyle

public com.klg.jclass.swing.gauge.JCIndicatorStyle getIndicatorStyle()
Returns the JCIndicatorStyle for this indicator.

Specified by:
getIndicatorStyle in interface JCIndicator
Returns:
the JCIndicatorStyle of this indicator

setIndicatorStyle

public void setIndicatorStyle(com.klg.jclass.swing.gauge.JCIndicatorStyle indicatorStyle)
Sets the JCIndicatorStyle for this indicator.

Specified by:
setIndicatorStyle in interface JCIndicator
Parameters:
indicatorStyle - the JCIndicatorStyle for this indicator

getIndicatorWidth

public double getIndicatorWidth()
Returns the indicator width in pixels.

Specified by:
getIndicatorWidth in interface JCIndicator
Returns:
the indicator width in pixels

setIndicatorWidth

public void setIndicatorWidth(double indicatorWidth)
Sets the indicator width in pixels.

Specified by:
setIndicatorWidth in interface JCIndicator
Parameters:
indicatorWidth - the indicator width in pixels

isReversed

public boolean isReversed()
Asks :"Is the indicator reversed?".

Specified by:
isReversed in interface JCIndicator
Returns:
whether the indicator is reversed or not

setReversed

public void setReversed(boolean reversed)
Sets the reversed property of the indicator. If the indicator is reversed it draws in the opposite direction (for example, for linear scales it points left or up instead of right or down, for circular scales it points towards the center instead of away from the center).

Specified by:
setReversed in interface JCIndicator
Parameters:
reversed - is the indicator's direction reversed

redraw

public void redraw()
Call this instead of paint so that the repaintEnabled flag can be checked. No repaint will occur if that flag is false.


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