org.jscience.awt.leds
Class LEDBase

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Canvas
          extended by org.jscience.awt.leds.LEDBase
All Implemented Interfaces:
java.awt.event.ActionListener, java.awt.image.ImageObserver, java.awt.MenuContainer, java.beans.PropertyChangeListener, java.io.Serializable, java.util.EventListener, javax.accessibility.Accessible
Direct Known Subclasses:
RoundLED, SquareLED

public abstract class LEDBase
extends java.awt.Canvas
implements java.beans.PropertyChangeListener, java.awt.event.ActionListener

DOCUMENT ME!

See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class java.awt.Canvas
java.awt.Canvas.AccessibleAWTCanvas
 
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
protected  java.awt.Color ledOffColor
          DOCUMENT ME!
protected  java.awt.Color ledOnColor
          DOCUMENT ME!
protected  boolean ledState
          DOCUMENT ME!
static int MODEBLINK
          DOCUMENT ME!
static int MODEPULSE
          DOCUMENT ME!
static int MODESOLID
          DOCUMENT ME!
protected  java.awt.Color panelColor
          DOCUMENT ME!
 
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
LEDBase(java.awt.Color ledColor, java.awt.Color panelColor, int mode, boolean rate, boolean state)
          Creates a new LEDBase object.
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
          DOCUMENT ME!
 boolean getLEDBlinkRate()
          True means the LED will blink at a fast rate.
 java.awt.Color getLEDColor()
          DOCUMENT ME!
 int getLEDMode()
          DOCUMENT ME!
 boolean getLEDState()
          True means LED is not off.
 java.awt.Color getPanelColor()
          DOCUMENT ME!
abstract  java.awt.Dimension getPreferredSize()
          DOCUMENT ME!
abstract  void paint(java.awt.Graphics g)
          DOCUMENT ME!
 void propertyChange(java.beans.PropertyChangeEvent evt)
          A small state machine to control the LED.
 void setLEDBlinkRate(boolean rate)
          DOCUMENT ME!
 void setLEDColor(java.awt.Color ledOnColor)
          DOCUMENT ME!
 void setLEDMode(int mode)
          DOCUMENT ME!
 void setLEDState(boolean state)
          DOCUMENT ME!
 void setPanelColor(java.awt.Color panelColor)
          DOCUMENT ME!
 
Methods inherited from class java.awt.Canvas
addNotify, createBufferStrategy, createBufferStrategy, getAccessibleContext, getBufferStrategy, update
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBaseline, getBaselineResizeBehavior, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeys, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getListeners, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusCycleRoot, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isOpaque, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paramString, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, processComponentEvent, processEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeys, setFocusTraversalKeysEnabled, setFont, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MODESOLID

public static final int MODESOLID
DOCUMENT ME!

See Also:
Constant Field Values

MODEBLINK

public static final int MODEBLINK
DOCUMENT ME!

See Also:
Constant Field Values

MODEPULSE

public static final int MODEPULSE
DOCUMENT ME!

See Also:
Constant Field Values

panelColor

protected java.awt.Color panelColor
DOCUMENT ME!


ledOnColor

protected java.awt.Color ledOnColor
DOCUMENT ME!


ledOffColor

protected java.awt.Color ledOffColor
DOCUMENT ME!


ledState

protected boolean ledState
DOCUMENT ME!

Constructor Detail

LEDBase

public LEDBase(java.awt.Color ledColor,
               java.awt.Color panelColor,
               int mode,
               boolean rate,
               boolean state)
Creates a new LEDBase object.

Parameters:
ledColor - DOCUMENT ME!
panelColor - DOCUMENT ME!
mode - DOCUMENT ME!
rate - DOCUMENT ME!
state - DOCUMENT ME!
Method Detail

getLEDColor

public java.awt.Color getLEDColor()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setLEDColor

public void setLEDColor(java.awt.Color ledOnColor)
DOCUMENT ME!

Parameters:
ledOnColor - DOCUMENT ME!

getPanelColor

public java.awt.Color getPanelColor()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setPanelColor

public void setPanelColor(java.awt.Color panelColor)
DOCUMENT ME!

Parameters:
panelColor - DOCUMENT ME!

getLEDMode

public int getLEDMode()
DOCUMENT ME!

Returns:
DOCUMENT ME!

setLEDMode

public void setLEDMode(int mode)
DOCUMENT ME!

Parameters:
mode - DOCUMENT ME!

getLEDBlinkRate

public boolean getLEDBlinkRate()
True means the LED will blink at a fast rate. False means the LED will blink at 1/2 the fast rate. LED will only blink, however, if mode is MODEBLINK and state is true.

Returns:
DOCUMENT ME!

setLEDBlinkRate

public void setLEDBlinkRate(boolean rate)
DOCUMENT ME!

Parameters:
rate - DOCUMENT ME!

getLEDState

public boolean getLEDState()
True means LED is not off. That is, it is either on or blinking. False means the LED is off

Returns:
DOCUMENT ME!

setLEDState

public void setLEDState(boolean state)
DOCUMENT ME!

Parameters:
state - DOCUMENT ME!

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
DOCUMENT ME!

Specified by:
actionPerformed in interface java.awt.event.ActionListener
Parameters:
e - DOCUMENT ME!

propertyChange

public void propertyChange(java.beans.PropertyChangeEvent evt)
A small state machine to control the LED. It is meant to limit the number of repaints getting generated so that the LED does not studder as much as it would otherwise.

Specified by:
propertyChange in interface java.beans.PropertyChangeListener
Parameters:
evt - DOCUMENT ME!

paint

public abstract void paint(java.awt.Graphics g)
DOCUMENT ME!

Overrides:
paint in class java.awt.Canvas
Parameters:
g - DOCUMENT ME!

getPreferredSize

public abstract java.awt.Dimension getPreferredSize()
DOCUMENT ME!

Overrides:
getPreferredSize in class java.awt.Component
Returns:
DOCUMENT ME!