org.jscience.awt.meters
Class LEDMeter

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by java.awt.Panel
              extended by org.jscience.awt.meters.Meter
                  extended by org.jscience.awt.meters.LEDMeter
All Implemented Interfaces:
java.awt.event.AdjustmentListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible

public class LEDMeter
extends Meter

DOCUMENT ME!

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Panel
java.awt.Panel.AccessibleAWTPanel
 
Nested classes/interfaces inherited from class java.awt.Container
java.awt.Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
 
Field Summary
 
Fields inherited from class org.jscience.awt.meters.Meter
caption, DEFAULTFONTNAME, DEFAULTFONTSIZE, DEFAULTFONTSTYLE, font, fontName, fontSize, fontStyle, hasHighlight, hasLabels, height, highlightBrighterColor, highlightDarkerColor, labelDist, labelPercent, labels, meterGranularity, meterImage, meterMode, METERRANGE, MODEAVG, MODENONE, MODEPEAK, MODEPEAKHOLD, MODERMS, MODEVU, needleColor, NEEDLECOLOR, numberOfSections, panelColor, PANELCOLOR, textColor, TEXTCOLOR, value, width
 
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
LEDMeter()
          LED Meter Class Constructor with zero arguments.
LEDMeter(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, int numberOfSections, java.awt.Color panelColor, java.awt.Color textColor)
          LED Meter Class Constructor with all agruments
LEDMeter(int width, int height, java.lang.String caption, int value)
          LED Meter Class Constructor with reasonable defaults
 
Method Summary
 java.awt.Dimension getPreferredSize()
          Return the preferred size of this LED meter
static void main(java.lang.String[] args)
          DOCUMENT ME!
 void paint(java.awt.Graphics g)
          Paint the meter into the graphics context
 void setColorRange(java.awt.Color color, int minPercentValue, int maxPercentValue)
          Set a color for a range of values on the meter's LEDs.
 void setHeight(int height)
          Overloaded base class method for setting height of LED meter Forces recalculation of section sizes
 void setNumberOfSections(int numberOfSections)
          Overloaded base class method for setting the number of meter sections.
 void setPanelColor(java.awt.Color panelColor)
          Overloaded base class method for setting panel color.
 
Methods inherited from class org.jscience.awt.meters.Meter
adjustmentValueChanged, getCaption, getFont, getFontName, getFontSize, getFontStyle, getHasLabels, getHeight, getHighlight, getLabelPercent, getLabelsString, getMeterMode, getNeedleColor, getNumberOfSections, getPanelColor, getTextColor, getValue, getWidth, round, setCaption, setFont, setFontName, setFontSize, setFontStyle, setHasLabels, setHighlight, setLabelPercent, setLabelsString, setMeterMode, setNeedleColor, setTextColor, setValue, setWidth, sizeToFit
 
Methods inherited from class java.awt.Panel
addNotify, getAccessibleContext
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, 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, paramString, preferredSize, print, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, removeNotify, setComponentZOrder, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, update, 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, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, disableEvents, dispatchEvent, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

LEDMeter

public LEDMeter(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,
                int numberOfSections,
                java.awt.Color panelColor,
                java.awt.Color textColor)
LED Meter Class Constructor with all agruments

Parameters:
width - width is the width in pixels of the meter
height - height is the height in pixels of the meter
meterMode - meterMode is not currently used
fontName - fontName is the name of the font for labelling
fontStyle - fontStyle is the name of the font style for labelling
fontSize - fontSize is the size of the font for labelling
caption - caption is the caption to label the meter with
hasLabels - hasLabels is true if the meter has labels and it is desired they are displayed.
labelsString - 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 - labelPercent is the percentage relative to the meter's width where the labels will be drawn.
value - value is the value the meter should initially display
hasHighlight - hasHighlight is true if highlighting should be used for the meter's display.
numberOfSections - numberOfSections is the number of sections the meter should be divided into.
panelColor - panelColor is the color of the panel surrounding the meter.
textColor - textColor is the color used for the labelling text

LEDMeter

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

Parameters:
width - DOCUMENT ME!
height - DOCUMENT ME!
caption - DOCUMENT ME!
value - DOCUMENT ME!

LEDMeter

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

Method Detail

paint

public void paint(java.awt.Graphics g)
Paint the meter into the graphics context

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

getPreferredSize

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

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

setColorRange

public void setColorRange(java.awt.Color color,
                          int minPercentValue,
                          int maxPercentValue)
Set a color for a range of values on the meter's LEDs.

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

setHeight

public void setHeight(int height)
Overloaded base class method for setting height of LED meter Forces recalculation of section sizes

Overrides:
setHeight in class Meter
Parameters:
height - height is the new height for the LED meter

setNumberOfSections

public void setNumberOfSections(int numberOfSections)
Overloaded base class method for setting the number of meter sections. Recalculates the section sizes

Overrides:
setNumberOfSections in class Meter
Parameters:
numberOfSections - height is the new height for the LED meter

setPanelColor

public void setPanelColor(java.awt.Color panelColor)
Overloaded base class method for setting panel color. Overloaded to produce other colors needed for shading.

Overrides:
setPanelColor in class Meter
Parameters:
panelColor - panelColor the color to set the panel surrounding the meter to.

main

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

Parameters:
args - DOCUMENT ME!