JClass DesktopViews 6.3.0 API
Documentation

com.klg.jclass.swing.gauge
Class JCLinearGauge

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--javax.swing.JComponent
                    |
                    +--com.klg.jclass.swing.gauge.JCGauge
                          |
                          +--com.klg.jclass.swing.gauge.JCLinearGauge
All Implemented Interfaces:
EventListener, ImageObserver, LegendComponentLayoutUser, MenuContainer, MouseListener, MouseMotionListener, Serializable, com.klg.jclass.util.ServerRenderable
Direct Known Subclasses:
JCLinearGaugeBean

public class JCLinearGauge
extends JCGauge
implements com.klg.jclass.util.ServerRenderable

JCLinearGauge.

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  Vector labels
          The list of labels for this gauge.
 
Fields inherited from class com.klg.jclass.swing.gauge.JCGauge
draggedNeedle, footer, footerLayoutHints, gaugeArea, gaugeAreaLayoutHints, header, headerLayoutHints, image, indicators, legend, legendLayoutHints, needles, pickListeners, repaintEnabled, scale, scaleImage, snapToValue
 
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
JCLinearGauge()
          No-argument constructor for JCLinearGauge.
JCLinearGauge(boolean createScale)
          Constructs a JCLinearGauge with no default objects except possibly a linear scale.
 
Method Summary
 void addLabel(JComponent label, com.klg.jclass.swing.gauge.LinearConstraint constraint)
          Adds a label to the gauge.
 void addLabel(JComponent label, com.klg.jclass.swing.gauge.LinearConstraint constraint, int index)
          Adds a label to the gauge.
protected  void drawImage(Graphics g, Image image, Rectangle bounds, Color color)
          Draws an image as the gauge background.
 com.klg.jclass.swing.gauge.JCLinearNeedle getClosestNeedle(com.klg.jclass.swing.gauge.JCGaugePickEvent pe, JCAbstractNeedle.InteractionType interactionType)
          Returns the closest needle to the clicked/dragged point.
 Graphics getGraphics()
          Overrides parent getGraphics().
 com.klg.jclass.swing.gauge.JCLinearScale getLinearScale()
          Returns the linear gauge's linear scale (appropriately cast).
 void mouseClicked(MouseEvent event)
          Sends pick events to listeners and moves the closest needle with a CLICK interaction enabled to the value indicated by the mouse click.
 void mouseDragged(MouseEvent event)
          Drags the closest needle.
 void paintComponent(Graphics g)
          Paints the gauge.
 void redraw()
          Call this instead of paint so that the repaintEnabled flag can be checked.
 void removeLabel(JComponent label)
          Removes a label.
 void serverPaint(Graphics igc)
          Internal use only.
 Image serverSnapshot()
          Internal use only.
 void setGraphics(Graphics g)
          Provides a way for the circular gauge to draw to a custom Graphics object.
 void setScale(com.klg.jclass.swing.gauge.JCLinearScale scale)
          Adds a linear scale to the linear gauge.
 void setScale(com.klg.jclass.swing.gauge.JCLinearScale scale, boolean addToGaugeArea)
          Adds a linear scale to the linear gauge.
protected  int valueToPosition(double value)
          A convenience method that returns the position corresponding to a linear scale value.
 
Methods inherited from class com.klg.jclass.swing.gauge.JCGauge
addIndicator, addIndicator, addNeedle, addNeedle, addPickListener, addRange, addRange, addTick, addTick, getAbout, getComponentArea, getDrawingAreaHeight, getDrawingAreaWidth, getFooter, getGaugeArea, getHeader, getImage, getIndicators, getLayoutHints, getLegend, getNeedles, getRanges, getRepaintEnabled, getScale, getScaleImage, getSnapToValue, getTicks, mouseEntered, mouseExited, mouseMoved, mousePressed, mouseReleased, pick, removeIndicator, removeNeedle, removePickListener, removeRange, removeTick, sendPickEvent, setAbout, setFooter, setGaugeArea, setHeader, setImage, setIndicatorScales, setLegend, setNeedleScales, setRepaintEnabled, setScaleImage, setSnapToValue
 
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, getHeight, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, 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.util.legend.LegendComponentLayoutUser
getPreferredSize
 

Field Detail

labels

protected Vector labels
The list of labels for this gauge.

See Also:
JCLabelGenerator
Constructor Detail

JCLinearGauge

public JCLinearGauge()
No-argument constructor for JCLinearGauge. Creates a default scale, needle, and tick marks.

See Also:
setScale(JCLinearScale), JCGauge.addIndicator(JCAbstractIndicator), JCGauge.addNeedle(JCAbstractNeedle), JCAbstractScale.addRange(JCRange), JCGauge.addTick(JCTick), JCGauge.getScale(), JCGauge.removeIndicator(JCAbstractIndicator), JCGauge.removeNeedle(JCAbstractNeedle), JCAbstractScale.removeRange(JCRange), JCGauge.removeTick(JCTick)

JCLinearGauge

public JCLinearGauge(boolean createScale)
Constructs a JCLinearGauge with no default objects except possibly a linear scale. Use the following methods to add needles, indicators, ticks, and ranges.

Parameters:
createScale -
See Also:
JCGauge.addIndicator(JCAbstractIndicator), JCGauge.addNeedle(JCAbstractNeedle), JCAbstractScale.addRange(JCRange), JCGauge.addTick(JCTick), JCGauge.getScale(), JCGauge.removeIndicator(JCAbstractIndicator), JCGauge.removeNeedle(JCAbstractNeedle), JCAbstractScale.removeRange(JCRange), JCGauge.removeTick(JCTick)
Method Detail

paintComponent

public void paintComponent(Graphics g)
Paints the gauge.

Overrides:
paintComponent in class JComponent
Parameters:
g - The Graphics with which to paint

getLinearScale

public com.klg.jclass.swing.gauge.JCLinearScale getLinearScale()
Returns the linear gauge's linear scale (appropriately cast).

Returns:
the linear gauge's linear scale

setScale

public void setScale(com.klg.jclass.swing.gauge.JCLinearScale scale,
                     boolean addToGaugeArea)
Adds a linear scale to the linear gauge.

Parameters:
scale - the linear scale to be added
addToGaugeArea - Add the scale to the JCGaugeArea parent?

setScale

public void setScale(com.klg.jclass.swing.gauge.JCLinearScale scale)
Adds a linear scale to the linear gauge.

Parameters:
scale - the linear scale to be added

addLabel

public void addLabel(JComponent label,
                     com.klg.jclass.swing.gauge.LinearConstraint constraint)
Adds a label to the gauge.

Parameters:
label - the JComponent to be added as a label
constraint - the LinearConstraint specifying where to place the label

addLabel

public void addLabel(JComponent label,
                     com.klg.jclass.swing.gauge.LinearConstraint constraint,
                     int index)
Adds a label to the gauge.

Parameters:
label - the JComponent to be added as a label
constraint - the LinearConstraint specifying where to place the label
index - the z-order index

removeLabel

public void removeLabel(JComponent label)
Removes a label.

Parameters:
label - the JComponent to be removed

mouseClicked

public void mouseClicked(MouseEvent event)
Sends pick events to listeners and moves the closest needle with a CLICK interaction enabled to the value indicated by the mouse click.

Specified by:
mouseClicked in interface MouseListener
Overrides:
mouseClicked in class JCGauge
Parameters:
event - a MouseEvent

mouseDragged

public void mouseDragged(MouseEvent event)
Drags the closest needle.

Specified by:
mouseDragged in interface MouseMotionListener
Overrides:
mouseDragged in class JCGauge
Parameters:
event - a MouseEvent

getClosestNeedle

public com.klg.jclass.swing.gauge.JCLinearNeedle getClosestNeedle(com.klg.jclass.swing.gauge.JCGaugePickEvent pe,
                                                                  JCAbstractNeedle.InteractionType interactionType)
Returns the closest needle to the clicked/dragged point. Returns closest needle of type CLICK/DRAG/CLICK_DRAG, or if there are none of these, the closest needle of type NONE.

Parameters:
pe - the pick event with the click inforamation
interactionType - the needle must be of this JCAbstractNeedle.InteractionType
Returns:
the closest needle of the indicated type

valueToPosition

protected int valueToPosition(double value)
A convenience method that returns the position corresponding to a linear scale value.

Parameters:
value - a circular scale value.
Returns:
The position based on the value.

drawImage

protected void drawImage(Graphics g,
                         Image image,
                         Rectangle bounds,
                         Color color)
Draws an image as the gauge background.

Parameters:
bounds -
color -
image -
g - the Graphics on 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.

Specified by:
redraw in class JCGauge

getGraphics

public Graphics getGraphics()
Overrides parent getGraphics(). If another Graphics object has been set to be the current one, will return that. Otherwise, call the superclass' getGraphics() method.

Specified by:
getGraphics in interface com.klg.jclass.util.ServerRenderable
Overrides:
getGraphics in class JComponent
Returns:
the Graphics object to use to draw this chart

setGraphics

public void setGraphics(Graphics g)
Provides a way for the circular gauge to draw to a custom Graphics object. Call with a null to specify use of the default Graphics object used to draw to the screen.

Specified by:
setGraphics in interface com.klg.jclass.util.ServerRenderable
Parameters:
g - Graphics object to use for drawing

serverSnapshot

public Image serverSnapshot()
Internal use only. Don't use.

Specified by:
serverSnapshot in interface com.klg.jclass.util.ServerRenderable

serverPaint

public void serverPaint(Graphics igc)
Internal use only. Don't use.

Specified by:
serverPaint in interface com.klg.jclass.util.ServerRenderable

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