JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.swing.gauge
Class JCLinearRange

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

public class JCLinearRange
extends JCAbstractRange

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
protected  Image backgroundImage
          The background image used as range.
protected  double foregroundCoverage
          Percent of foreground image that covers background image.
protected  Image foregroundImage
          The foreground image used as range.
static int HORIZONTAL
          Constants used for the masking orientation of the background image.
protected  int maskOrientation
          The coverage orientation.
static int VERTICAL
           
 
Fields inherited from class com.klg.jclass.swing.gauge.JCAbstractRange
image, innerExtent, outerExtent, rangeCounter, rangeName, scale, scaleImage, startValue, stopValue
 
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
JCLinearRange(Color foreground, com.klg.jclass.swing.gauge.JCLinearScale scale, double innerExtent, double outerExtent, double startValue, double stopValue)
          Creates a linear range.
 
Method Summary
protected  void drawImage(Graphics g, Rectangle bounds)
          Draws an image as the range.
 Image getBackgroundImage()
          Returns the background image of the range.
 double getForegroundCoverage()
          Returns the foreground coverage of the background.
 Image getForegroundImage()
          Returns the foreground image of the range.
 Image getImage()
          Returns the background image of the range.
 Rectangle getLinearRangeSize(com.klg.jclass.swing.gauge.JCLinearScale lscale, Rectangle bounds)
          This routine computes the range rectangle to be drawn with respect to range's scale.
protected  com.klg.jclass.swing.gauge.JCLinearScale getLinearScale()
          Returns the linear scale associated with this range.
 int getMaskOrientation()
          Gets the mask orientation of the range.
 Dimension getPreferredSize()
          Returns the preferred size of this range, which will be the preferred size of the scale.
 void paintComponent(Graphics g)
          Draws a linear range.
 void redraw()
          Call this instead of paint so that the repaintEnabled flag can be checked.
 void setBackgroundImage(Image image)
          Sets the background image of the range.
 void setForegroundCoverage(double coverage)
          Sets the foreground coverage of the background.
 void setForegroundImage(Image image)
          Sets the foreground image of the range.
 void setImage(Image image)
          Sets the background image of the range.
 void setMaskOrientation(int orientation)
          Sets the mask orientation.
 
Methods inherited from class com.klg.jclass.swing.gauge.JCAbstractRange
getInnerExtent, getOuterExtent, getRangeName, getScale, getScaleImage, getStartValue, getStopValue, setInnerExtent, setOuterExtent, setRangeName, setScaleImage, setStartValue, setStopValue
 
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, paintChildren, 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
 
Methods inherited from interface com.klg.jclass.swing.gauge.JCRange
getForeground
 

Field Detail

HORIZONTAL

public static final int HORIZONTAL
Constants used for the masking orientation of the background image.

See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
See Also:
Constant Field Values

foregroundImage

protected Image foregroundImage
The foreground image used as range.


backgroundImage

protected Image backgroundImage
The background image used as range.


foregroundCoverage

protected double foregroundCoverage
Percent of foreground image that covers background image.


maskOrientation

protected int maskOrientation
The coverage orientation.

Constructor Detail

JCLinearRange

public JCLinearRange(Color foreground,
                     com.klg.jclass.swing.gauge.JCLinearScale scale,
                     double innerExtent,
                     double outerExtent,
                     double startValue,
                     double stopValue)
Creates a linear range.

Parameters:
foreground - the range's color
scale - the scale associated with this range
innerExtent - the ratio of the scale's width/height to start drawing this range from the top/left of the scale (for example, for a horizontal scale, a value of 0.8 means start drawing this range 80% of the scale's height from the top of the scale)
outerExtent - the ratio of the scale's width/height to stop drawing this range from the top/left of the scale (for example, for a vertical scale, a value of 0.9 means stop drawing this range 90% of the scale's width from the left of the scale)
startValue - the scale value (not position) at which to begin the range
stopValue - the scale value (not position) at which to stop the range
Method Detail

getLinearScale

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

Returns:
the linear scale associated with this range

getPreferredSize

public Dimension getPreferredSize()
Returns the preferred size of this range, which will be the preferred size of the scale.

Overrides:
getPreferredSize in class JComponent
Returns:
the preferred size

getLinearRangeSize

public Rectangle getLinearRangeSize(com.klg.jclass.swing.gauge.JCLinearScale lscale,
                                    Rectangle bounds)
This routine computes the range rectangle to be drawn with respect to range's scale.

Parameters:
lscale - the JCLinearScale of this range
bounds - the linear scale bounds; use lscale.getScaleSize() for range painting and lscale.getBounds() for image mapping
Returns:
Rectangle defines the range position and dimensions

paintComponent

public void paintComponent(Graphics g)
Draws a linear range.

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

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.

Overrides:
redraw in class JCAbstractRange

setImage

public void setImage(Image image)
Sets the background image of the range. Overrides the superclass method.

Overrides:
setImage in class JCAbstractRange
Parameters:
image - the background image of the range

setForegroundImage

public void setForegroundImage(Image image)
Sets the foreground image of the range.

Parameters:
image - the foreground image of the range

setBackgroundImage

public void setBackgroundImage(Image image)
Sets the background image of the range.

Parameters:
image - the background image of the range

getImage

public Image getImage()
Returns the background image of the range. Overrides the superclass method.

Overrides:
getImage in class JCAbstractRange
Returns:
image the bakcground image of the range

getForegroundImage

public Image getForegroundImage()
Returns the foreground image of the range.

Returns:
image the foreground image of the range

getBackgroundImage

public Image getBackgroundImage()
Returns the background image of the range.

Returns:
image the background image of the range

setForegroundCoverage

public void setForegroundCoverage(double coverage)
Sets the foreground coverage of the background.

Parameters:
coverage - the coverage factor is a float between 0 and 1

getForegroundCoverage

public double getForegroundCoverage()
Returns the foreground coverage of the background.

Returns:
float the foreground coverage of the range

setMaskOrientation

public void setMaskOrientation(int orientation)
Sets the mask orientation. There are two possible values: for JCLinearRange.HORIZONTAL, the foreground image covers the left side of the background image; for JCLinearRange.VERTICAL, the foreground image covers the upper side of the background image.

Parameters:
orientation - the mask orientation of the range

getMaskOrientation

public int getMaskOrientation()
Gets the mask orientation of the range.

Returns:
maskOrientation the mask orientation of the range

drawImage

protected void drawImage(Graphics g,
                         Rectangle bounds)
Draws an image as the range.

Parameters:
g - the Graphics on which to draw
bounds - the bounds of the image used for image scaling

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