JClass 4.5.0 API
Documentation

com.klg.jclass.swing.gauge
Class JCScale

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.klg.jclass.swing.gauge.JCScale
Direct Known Subclasses:
JCCircularScale

public abstract class JCScale
extends JComponent

A graduated scale. A scale has a minimum value, a maximum value, a direction, and associated JCTick objects.

See Also:
Serialized Form

Inner Class Summary
static class JCScale.Direction
          Enum's for the direction parameter.
 
Inner classes inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Field Summary
protected  JCScale.Direction direction
          A JCCircularScale.Direction enum, CLOCKWISE or COUNTERCLOCKWISE, giving the direction in which scale values increase.
protected  double max
          The minumum value this scale can have.
protected  double min
          The maximum value this scale can have.
protected  Vector ticks
          A list of tick objects for this scale.
 
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
JCScale()
          Create a graduated scale.
JCScale(JCScale.Direction direction, double min, double max, Color foreground)
          Creates a graduated scale.
 
Method Summary
 void addTick(JCTick tick)
          Adds a tick object to a gauge.
 void addTick(JCTick tick, int index)
          Adds a tick object to a gauge.
 JCScale.Direction getDirection()
          Returns the JCCircularScale.Direction for this scale, CLOCKWISE or COUNTERCLOCKWISE, giving the direction in which scale values increase.
 double getMax()
          Returns the maximum value for this scale.
 double getMin()
          Returns the minimum value for this scale.
 Vector getTicks()
          Returns the the Vector of tick objects for this scale.
 boolean inBounds(double value)
          Returns true if the value is within the scale's minimum and maximum.
 void redraw()
          Call this instead of paint so that the repaintEnabled flag can be checked.
 void removeTick(JCTick tick)
          Removes a tick from a gauge.
 void setDirection(JCScale.Direction direction)
          Sets the JCCircularScale.Direction for this scale, CLOCKWISE or COUNTERCLOCKWISE, giving the direction in which scale values increase.
 void setMax(double max)
          Sets the maximum value for this scale.
 void setMin(double min)
          Sets the minimum value for this scale.
 
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, getPreferredSize, 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, paintChildren, paintComponent, paintImmediately, paintImmediately, paramString, processComponentKeyEvent, processFocusEvent, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, resetKeyboardActions, reshape, 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
 

Field Detail

direction

protected JCScale.Direction direction
A JCCircularScale.Direction enum, CLOCKWISE or COUNTERCLOCKWISE, giving the direction in which scale values increase.
Default: counterclockwise.

min

protected double min
The maximum value this scale can have.

max

protected double max
The minumum value this scale can have.

ticks

protected Vector ticks
A list of tick objects for this scale.
Constructor Detail

JCScale

public JCScale()
Create a graduated scale.

JCScale

public JCScale(JCScale.Direction direction,
               double min,
               double max,
               Color foreground)
Creates a graduated scale.
Parameters:
direction -  
min -  
max -  
foreground -  
Method Detail

getDirection

public JCScale.Direction getDirection()
Returns the JCCircularScale.Direction for this scale, CLOCKWISE or COUNTERCLOCKWISE, giving the direction in which scale values increase.
Returns:
The JCCircularScale.Direction for this scale

setDirection

public void setDirection(JCScale.Direction direction)
Sets the JCCircularScale.Direction for this scale, CLOCKWISE or COUNTERCLOCKWISE, giving the direction in which scale values increase.
Parameters:
direction - The JCCircularScale.Direction

getMax

public double getMax()
Returns the maximum value for this scale.
Returns:
The maximum value for this scale

setMax

public void setMax(double max)
Sets the maximum value for this scale.
Parameters:
max - The maxiumum value for this scale

getMin

public double getMin()
Returns the minimum value for this scale.
Returns:
The minimum value for this scale

setMin

public void setMin(double min)
Sets the minimum value for this scale.
Parameters:
min - The minimum value for this scale

getTicks

public Vector getTicks()
Returns the the Vector of tick objects for this scale.
Returns:
A Vector of ticks

addTick

public void addTick(JCTick tick)
Adds a tick object to a gauge.
Parameters:
tick - The Tick object to be added

addTick

public void addTick(JCTick tick,
                    int index)
Adds a tick object to a gauge.
Parameters:
tick - The JCTick to be added to the scale
index - The z-order index

removeTick

public void removeTick(JCTick tick)
Removes a tick from a gauge.
Parameters:
tick - The JCCircularTick to be removed

inBounds

public boolean inBounds(double value)
Returns true if the value is within the scale's minimum and maximum.
Parameters:
value - The value to be tested
Returns:
true if the value is within the scale's minimum and maximum

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© 1999-2000 KL Group Inc.
All rights reserved.