vipratech.beans.standardbeans
Class DigitalMeter

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Canvas
              |
              +--vipratech.beans.standardbeans.DigitalMeter

public class DigitalMeter
extends java.awt.Canvas
implements InterfaceProperties

The DigitMeter.class is a GUI component used to dynamically display values using an LED or LCD digital type meter display composed of seven-element digits. Each element in the digit can either be active or inactive.

The value of the meter is set using the setValue(float value) method or by wiring the meter up to adjustment event sources at design time. For example, the meter can be wired up to standard java.awt.Scrollbar components or to vipratech.beans.HorizontalSlider, or vipratech.beans.VerticalSlider.

If the meter is to display negative values, then an extra digit should be added at design time to display the minus sign.

The value of the meter may also be set using a property change event. For example, the meter may be wired up to vipratech.beans.SimpleDataSource at design time.

Each digit in the meter is an instance of the vipratech.beans.Digit object.

Version:
1.03, June 13, 2002
Author:
Warwick Bailey   warwick-bailey@bigfoot.com
See Also:
MeterSupport, Digit, Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
DigitalMeter()
           
 
Method Summary
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent event)
          Method for receiving adjustment events.
 void destroy()
          Cleans up offscreen graphics.
 java.awt.Color getActive()
          Returns the color of the active digit elements.
 boolean getBevel()
          Returns the toggle of 3D edge effect on the border.
 int getBorder()
          Returns the background color of the meter.
 java.awt.Color getInactive()
          Returns the color of the inactive digit elements.
 float getInitValue()
          Returns the start and reset value to be displayed in the meter.
 boolean getInterfaceColors()
          Returns the toggle for the colors to match the current interface..
 java.awt.Color getMeterColor()
          Returns the background color of the meter.
 java.awt.Dimension getMinimumSize()
          Returns the minimum meter size.
 boolean getNegatives()
          Returns the toggle for negative numbers.
 int getNumberOfDigits()
          Returns the number of digits to be displayed.
 int getPlaces()
          Returns the number of decimal places to be displayed.
 java.lang.String getUnit()
          Returns the unit to be displayed.
 float getValue()
          Returns the value to be displayed in the meter.
 void paint(java.awt.Graphics g)
          Updates of screen image, then draw image to screen.
 void propertyChange(java.beans.PropertyChangeEvent event)
          Method to receive property change events.
 void reset()
          Resets the meter to the initial value.
 void setActive(java.awt.Color active)
          Sets the color of the active digit elements.
 void setBevel(boolean bevel)
          Toggle 3D edge effect on the border.
 void setBorder(int border)
          Sets the border size of the meter.
 void setInactive(java.awt.Color inactive)
          Sets the color of the inactive digit elements.
 void setInitValue(float initValue)
          Sets the start and reset value to be displayed in the meter.
 void setInterfaceColors(boolean interfaceColors)
          Toggle the colors to match the current interface.
 void setMeterColor(java.awt.Color meterColor)
          Sets the background color of the meter.
 void setNegatives(boolean negatives)
          Toggle display of negative numbers.
 void setNumberOfDigits(int numberOfDigits)
          Sets the number of digits to be displayed.
 void setPlaces(int places)
          Sets the number of decimal places to be displayed.
 void setUnit(java.lang.String unit)
          Sets the unit to be displayed.
 void setValue(float value)
          Sets the value to be displayed in the meter.
 void stop()
          Freezes the meter at the current value.
 void update(java.awt.Graphics g)
          Overidden method to avoid flickering during repaint.
 
Methods inherited from class java.awt.Canvas
addNotify
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, deliverEvent, disable, dispatchEvent, doLayout, enable, enable, enableInputMethods, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, preferredSize, prepareImage, prepareImage, print, printAll, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, validate
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DigitalMeter

public DigitalMeter()
Method Detail

adjustmentValueChanged

public void adjustmentValueChanged(java.awt.event.AdjustmentEvent event)
Method for receiving adjustment events. This is the target method when wiring up the meter to sources of adjustment event object (such as scrollers and scroll bars) at design time.

paint

public final void paint(java.awt.Graphics g)
Updates of screen image, then draw image to screen.
Overrides:
paint in class java.awt.Canvas

update

public final void update(java.awt.Graphics g)
Overidden method to avoid flickering during repaint.
Overrides:
update in class java.awt.Component

propertyChange

public final void propertyChange(java.beans.PropertyChangeEvent event)
Method to receive property change events. This method should accept property change events of objects of type Float

reset

public final void reset()
Resets the meter to the initial value.

stop

public void stop()
Freezes the meter at the current value.

destroy

public final void destroy()
Cleans up offscreen graphics. This method should be called when the applet or application closes down.

getMinimumSize

public final java.awt.Dimension getMinimumSize()
Returns the minimum meter size. The minimum size is set to 150 x 50 pixels.
Overrides:
getMinimumSize in class java.awt.Component

setValue

public final void setValue(float value)
Sets the value to be displayed in the meter.

getValue

public final float getValue()
Returns the value to be displayed in the meter.

setInitValue

public final void setInitValue(float initValue)
Sets the start and reset value to be displayed in the meter.

getInitValue

public final float getInitValue()
Returns the start and reset value to be displayed in the meter.

setNumberOfDigits

public final void setNumberOfDigits(int numberOfDigits)
Sets the number of digits to be displayed.

getNumberOfDigits

public final int getNumberOfDigits()
Returns the number of digits to be displayed.

setPlaces

public final void setPlaces(int places)
Sets the number of decimal places to be displayed.

getPlaces

public final int getPlaces()
Returns the number of decimal places to be displayed.

setActive

public final void setActive(java.awt.Color active)
Sets the color of the active digit elements.

getActive

public final java.awt.Color getActive()
Returns the color of the active digit elements.

setInactive

public final void setInactive(java.awt.Color inactive)
Sets the color of the inactive digit elements.

getInactive

public final java.awt.Color getInactive()
Returns the color of the inactive digit elements.

setMeterColor

public final void setMeterColor(java.awt.Color meterColor)
Sets the background color of the meter.

getMeterColor

public final java.awt.Color getMeterColor()
Returns the background color of the meter.

setUnit

public final void setUnit(java.lang.String unit)
Sets the unit to be displayed.

getUnit

public final java.lang.String getUnit()
Returns the unit to be displayed.

setBorder

public final void setBorder(int border)
Sets the border size of the meter.

getBorder

public final int getBorder()
Returns the background color of the meter.

setBevel

public final void setBevel(boolean bevel)
Toggle 3D edge effect on the border.

getBevel

public final boolean getBevel()
Returns the toggle of 3D edge effect on the border.

setInterfaceColors

public final void setInterfaceColors(boolean interfaceColors)
Toggle the colors to match the current interface.

getInterfaceColors

public final boolean getInterfaceColors()
Returns the toggle for the colors to match the current interface..

setNegatives

public final void setNegatives(boolean negatives)
Toggle display of negative numbers. The numbr of digits will have to be increased by one to accomodate the symbol for the minus sign.

getNegatives

public final boolean getNegatives()
Returns the toggle for negative numbers.

dathe@chemie.uni-leipzig.de"

http://leipzig.vernetztes-studium.de