jcontrol.ui.vole.meter
Class Thermometer

java.lang.Object
  |
  +--jcontrol.ui.vole.Component
        |
        +--jcontrol.ui.vole.meter.Thermometer

public class Thermometer
extends Component

The class Thermometer implements a classical thermometer as graphical Vole component. The final size of the thermometer depends on the width-to-height ratio given by the constructor or the setBounds-method. The thermometer is drawn that it completely fits into its bounding box. A thermometer without any inscription has a width-to-height ratio of 2 to 7 plus text height. Any inscription will be drawn on the right side of the fluid column, and with an inscription, the width-to-height ratio will change. So, if the thermometer is too small or not visible at all, you should try to increase the width first.

(C) DOMOLOGIC Home Automation GmbH 2003

Version:
1.0
Author:
Marcus Timmermann

Field Summary
 
Fields inherited from class jcontrol.ui.vole.Component
focusOwner, font, g, height, listener, parent, visible, width, x, y
 
Constructor Summary
Thermometer(int x, int y, int width, int height, int minValue, int maxValue)
          Constructs a new thermometer.
 
Method Summary
 void paint()
          Paints this component.
 void setFont(jcontrol.io.Resource font)
          Set the font for this component.
 void setGraphics(jcontrol.io.Graphics g)
          This method is called to set the main Display context for this component.
 void setInscription(java.lang.String inscriptMin, java.lang.String inscriptMax)
          Sets an inscription text which is displayed for the min and max value at the left of the histogram.
 void setNumericDisplay(int minDisplay, int maxDisplay, int decimals, java.lang.String unit)
          Sets the parameters of a numeric value display.
 void setValue(int value)
          Sets the thermometer value.
 boolean transferFocus()
          Thermometer never has the input focus
 
Methods inherited from class jcontrol.ui.vole.Component
getBounds, getParent, isVisible, onActionEvent, onKeyEvent, remove, removeFocus, requestFocus, setBounds, setLocation, setParent, setVisible, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, notifyAll, wait
 

Constructor Detail

Thermometer

public Thermometer(int x,
                   int y,
                   int width,
                   int height,
                   int minValue,
                   int maxValue)
Constructs a new thermometer.

Parameters:
x - the upper left x coordinate.
y - the upper left y coordinate.
width - the width
height - the height
minValue - the minimum value the BarMeter will be able to show
maxValue - the maximum value the BarMeter will be able to show
Method Detail

paint

public void paint()
Description copied from class: Component
Paints this component.

Overrides:
paint in class Component

setFont

public void setFont(jcontrol.io.Resource font)
Set the font for this component.

Overrides:
setFont in class Component
Parameters:
font - The new font.

setGraphics

public void setGraphics(jcontrol.io.Graphics g)
This method is called to set the main Display context for this component. Normally, this is done only for the top-level container, then, all child components are set automatically.

Overrides:
setGraphics in class Component
Parameters:
g - the Display

setInscription

public void setInscription(java.lang.String inscriptMin,
                           java.lang.String inscriptMax)
Sets an inscription text which is displayed for the min and max value at the left of the histogram.


setNumericDisplay

public void setNumericDisplay(int minDisplay,
                              int maxDisplay,
                              int decimals,
                              java.lang.String unit)
Sets the parameters of a numeric value display.

Parameters:
minDisplay - the minimum display value
maxDisplay - the maximum display value
decimals - The number of decimals behind the comma (may be "0").
unit - A String representing the unit of the thermometer, e.g. "°C"

setValue

public void setValue(int value)
Sets the thermometer value. If the value is out of the range minvalue .. maxvalue, the value will be cut.

Parameters:
value - the value

transferFocus

public boolean transferFocus()
Thermometer never has the input focus

Overrides:
transferFocus in class Component
Returns:
true, if the focus was transferred successfully.