gui.run.awt
Class AnalogMeter

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by gui.run.awt.Meter
                  extended by gui.run.awt.AnalogMeter
All Implemented Interfaces:
java.awt.event.AdjustmentListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible, javax.swing.event.ChangeListener

public class AnalogMeter
extends Meter
implements javax.swing.event.ChangeListener

See Also:
Serialized Form

Field Summary
 
Fields inherited from class gui.run.awt.Meter
DEFAULTFONTNAME, DEFAULTFONTSIZE, DEFAULTFONTSTYLE, METERRANGE, MODEAVG, MODENONE, MODEPEAK, MODEPEAKHOLD, MODERMS, MODEVU, NEEDLECOLOR, PANELCOLOR, TEXTCOLOR
 
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
AnalogMeter()
          Analog Meter Class Constructor with zero arguments.
AnalogMeter(int width, int height, int meterMode, java.lang.String fontName, int fontStyle, int fontSize, java.lang.String caption, boolean hasLabels, java.lang.String labelsString, int labelPercent, int value, boolean hasHighlight, java.awt.Color panelColor, java.awt.Color needleColor, java.awt.Color textColor)
          Analog Meter Class Constructor with all agruments
AnalogMeter(int width, int height, java.lang.String caption, int value)
          Analog Meter Class Constructor with reasonable defaults
AnalogMeter(javax.swing.SpinnerNumberModel snm)
           
 
Method Summary
 java.awt.Dimension getPreferredSize()
          Return the preferred size of this analog meter
static void main(java.lang.String[] args)
           
 void paint(java.awt.Graphics g)
          Paint the Analog Meter onto the graphics context.
 void resetMeterColorZones()
          Reset all of the color zones used for the meter.
 void setColorRange(java.awt.Color color, double minPercentValue, double maxPercentValue)
          Set a color for a range of values on the meter's scale.
 void setLabelPercent(int percent)
          Sets the distance as a percent of meter height where the meter labels should be placed.
 void stateChanged(javax.swing.event.ChangeEvent e)
           
 
Methods inherited from class gui.run.awt.Meter
adjustmentValueChanged, getCaption, getFontName, getFontSize, getFontStyle, getHasLabels, getHeight, getHighlight, getLabelPercent, getLabelsString, getMeterMode, getNeedleColor, getNumberOfSections, getPanelColor, getTextColor, getValue, getWidth, setCaption, setFontName, setFontSize, setFontStyle, setHasLabels, setHeight, setHighlight, setLabelsString, setMeterMode, setNeedleColor, setNumberOfSections, setPanelColor, setTextColor, setWidth
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AnalogMeter

public AnalogMeter(int width,
                   int height,
                   int meterMode,
                   java.lang.String fontName,
                   int fontStyle,
                   int fontSize,
                   java.lang.String caption,
                   boolean hasLabels,
                   java.lang.String labelsString,
                   int labelPercent,
                   int value,
                   boolean hasHighlight,
                   java.awt.Color panelColor,
                   java.awt.Color needleColor,
                   java.awt.Color textColor)
Analog Meter Class Constructor with all agruments

Parameters:
width - is the width in pixels of the meter
height - is the height in pixels of the meter
meterMode - is not currently used
fontName - is the name of the font for labelling
fontStyle - is the name of the font style for labelling
fontSize - is the size of the font for labelling
caption - is the caption to label the meter with
hasLabels - is true if the meter has labels and it is desired they are displayed.
labelsString - is the string of comma separated label strings used to label the meter. There can be any number specified and the analog meter will spread them evenly across the scale.
labelPercent - is the percentage relative to the meter's height where the labels will be drawn. Labels are drawn radially.
value - is the value the meter should initially display
hasHighlight - is true if highlighting should be used for the meter's display. Currently unused here.
panelColor - is the color of the panel surrounding the meter.
needleColor - is the color of the meter's needle
textColor - is the color used for the labelling text

AnalogMeter

public AnalogMeter(javax.swing.SpinnerNumberModel snm)

AnalogMeter

public AnalogMeter(int width,
                   int height,
                   java.lang.String caption,
                   int value)
Analog Meter Class Constructor with reasonable defaults


AnalogMeter

public AnalogMeter()
Analog Meter Class Constructor with zero arguments. Needed for use as a bean.

Method Detail

stateChanged

public void stateChanged(javax.swing.event.ChangeEvent e)
Specified by:
stateChanged in interface javax.swing.event.ChangeListener

paint

public void paint(java.awt.Graphics g)
Paint the Analog Meter onto the graphics context. Double buffering is used to reduce flicker.

Overrides:
paint in class java.awt.Container
Parameters:
g - is the graphics context on which to draw

getPreferredSize

public java.awt.Dimension getPreferredSize()
Return the preferred size of this analog meter

Overrides:
getPreferredSize in class java.awt.Container
Returns:
Dimension object containing the preferred size of the meter

resetMeterColorZones

public void resetMeterColorZones()
Reset all of the color zones used for the meter. This allows the zones to be changed at runtime if needed.


setColorRange

public void setColorRange(java.awt.Color color,
                          double minPercentValue,
                          double maxPercentValue)
Set a color for a range of values on the meter's scale. Creates a new MeterColorZone object to describe the range. NOTE: this isn't any overlap checking done here so the most recent range set sticks.

Parameters:
color - is the color for the specified range of values
minPercentValue - is the percentage of full scale value where this color should begin
maxPercentValue - is the percentage of full scale value where this color should end

setLabelPercent

public void setLabelPercent(int percent)
Sets the distance as a percent of meter height where the meter labels should be placed.

Overrides:
setLabelPercent in class Meter
Parameters:
percent - is the percent value

main

public static void main(java.lang.String[] args)