vipratech.beans.standardbeans
Class AnalogMeter

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

public class AnalogMeter
extends java.awt.Canvas
implements InterfaceProperties

The AnalogMeter.class is a GUI component used to dynamically display values using an analog type meter display.

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.standardbeans.HorizontalSlider, or vipratech.beans.standardbeans.VerticalSlider.

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

The AnalogMeter bean automatically resizes itself at design time to the correct width for a given height. This is required to maintian the correct relative width and height values to draw a semi-circular meter where the width is double the height.

The automatic resizing means that the meter should be sized at design time adjusting the height and allowing the width to be calculated by the bean.

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

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
AnalogMeter()
          Constructor.
 
Method Summary
 void adjustmentValueChanged(java.awt.event.AdjustmentEvent event)
          Method for receiving adjustment events.
 boolean getBevel()
          Returns the toggle of 3D edge effect on the border.
 int getBorder()
          Returns the background color of the meter.
 float getMaxValue()
          Returns meter maximum value.
 java.awt.Color getMeterColor()
          Returns the background color of the meter.
 java.awt.Dimension getMinimumSize()
          Returns the minimum meter size.
 float getMinValue()
          Returns current meter minimum value.
 int getPlaces()
          Returns the number of decimal places.
 boolean getPointer()
          Returns the toggle of line/pointer display for the meter.
 java.lang.String getUnitLabel()
          Returns the unit label.
 boolean getUnitVisible()
          Returns the toggle of the unit visible state.
 float getValue()
          Returns current meter value.
 void paint(java.awt.Graphics g)
          Draws all meter components to the screen.
 void propertyChange(java.beans.PropertyChangeEvent event)
          Method to receive property change events.
 void reset()
          Resets the meter to the initial value.
 void setBevel(boolean bevel)
          Toggle 3D edge effect on the border.
 void setBorder(int border)
          Sets the border size of the meter.
 void setMaxValue(float maxValue)
          Sets the meter maximum value.
 void setMeterColor(java.awt.Color meterColor)
          Sets the background color of the meter.
 void setMinValue(float minValue)
          Sets the meter minimum value.
 void setPlaces(int places)
          Sets the number of decimal places.
 void setPointer(boolean pointer)
          Toggle line/pointer display for the meter.
 void setUnitLabel(java.lang.String unitLabel)
          Sets the unit label.
 void setUnitVisible(boolean unitVisible)
          Toggle unit visible.
 void setValue(float value)
          Sets the meter value.
 void stop()
          Freezes the meter at the current value.
 void update(java.awt.Graphics g)
          Overidden method to reduce flicker when using double buffering.
 
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

AnalogMeter

public AnalogMeter()
Constructor.
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)
Draws all meter components to the screen.
Overrides:
paint in class java.awt.Canvas

update

public final void update(java.awt.Graphics g)
Overidden method to reduce flicker when using double buffering.
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 and type PointFloat

reset

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

stop

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

getMinimumSize

public final java.awt.Dimension getMinimumSize()
Returns the minimum meter size.
Overrides:
getMinimumSize in class java.awt.Component

setValue

public final void setValue(float value)
Sets the meter value.

getValue

public final float getValue()
Returns current meter value.

setMaxValue

public final void setMaxValue(float maxValue)
Sets the meter maximum value.

getMaxValue

public final float getMaxValue()
Returns meter maximum value.

setMinValue

public final void setMinValue(float minValue)
Sets the meter minimum value.

getMinValue

public final float getMinValue()
Returns current meter minimum value.

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.

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.

setPointer

public final void setPointer(boolean pointer)
Toggle line/pointer display for the meter.

getPointer

public boolean getPointer()
Returns the toggle of line/pointer display for the meter.

setBevel

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

getBevel

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

setUnitVisible

public final void setUnitVisible(boolean unitVisible)
Toggle unit visible.

getUnitVisible

public boolean getUnitVisible()
Returns the toggle of the unit visible state.

setUnitLabel

public final void setUnitLabel(java.lang.String unitLabel)
Sets the unit label.

getUnitLabel

public java.lang.String getUnitLabel()
Returns the unit label.

setPlaces

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

getPlaces

public int getPlaces()
Returns the number of decimal places.

dathe@chemie.uni-leipzig.de"

http://leipzig.vernetztes-studium.de