Thermometer Demo and Documentation

Display sketch code: ThermometerDemo.pde The Thermometer code is in the file ClickableMeter.pde

Thermometer is an extension of ClickableMeter that is similar to BarMeter except that it has a bulb on bottom so that it looks like a thermometer.

The demo shows two Thermometers. To convert a temperature, click on the left meter and the right one will adjust accordingly. The left hand meter uses the hashmark and value options. The right hand meter is an output only meter that doesn't respond to clicks. (Its a unclickable ClickableMeter!) It uses only the labels option.

Because Thermometer constructor has the same parameter list as ClickableMeter, it is easy to change sketches from one meter to the other by just changing the class names. This demo was created from the BarMeter that way after removing the horizontal meter. Actually, this page was largely created that way after deletion of sections. There is one major difference. The Thermometer must be oriented vertically with width <= height. In fact, normally width should be significantly smaller than height.

class Thermometer
extends ClickableMeter
which extends ClickablePanel
which extends Clickable

The Thermometer is a special vertical meter with a bulb to give it the appropriate look. While it is designed for input as well as display, it can be used for display only purposes by not checking for clicks in the mouseReleased() method. (Typically that means omitting it from the ClickableGroup and calling its display method in the draw() method.) Its constructor uses the same argument list as ClickableMeter's constructor. Note: The meter must have a vertical orientation with width <= its height.

** Thermometer(int leftX, int topY, int theWidth, int theHeight,
                    String theLabel, color stdColor, color overColor, color barColor,
                    float minValue, float value, float maxValue)
- Constructs a vertical Thermometer given the upper, left corner, the width and height, the label (not shown), three colors, and the min, current, max values. The min and max values can be reversed to reverse the display. The parameter list is the same for all the extensions of ClickableMeter:
* leftX - x (pixel) value of left side of meter.
* topY - y (pixel) value of top of meter.
* theWidth - the width of the meter (in pixels).
* theHeight - the height of the meter (in pixels). (width <= height is required.)
* theLabel - the label for the meter (not normally shown but may be useful for such things as debugging).
* stdColor - the normal color of the meter.
* overColor - the color used when mouse is over the meter.
* barColor - the color used for the bar or value marker line on the meter.
* minValue - the "minimum" (bottom or left) value displayed on the meter.
* value - the initial value displayed on the meter.
* maxValue - the "maximum" (top or right) value displayed on the meter.
* void display()
- Displays the vertical thermometer looking meter with a bulb at the bottom. It draws a bar from the min value to the current value of the meter using the barC, the bar color. The background is stdCol (overColor when the mouse is over the meter). It optionally displays hashmarks, labels and the value if requested by separate methods.

Method use codes:

** This constructor or method is designed to be called in the user sketch.

* This method is normally not called in the user's sketch unless the Clickable item was not been included in a ClickableGroup. ClickableGroup automatically uses the method as needed. Exception: This method may be needed if the user is extending Clickable with a new class.

# This constructor or method is rarely used in the user program. In Java, it would probably marked "private". Clickable, ScrollBar, and some other abstract constructors would never be called directly by the user sketch because they do nothing useful unless the user is extending a class.


Inherited from ClickableMeter

Fields
val, minVal, maxVal, valRange, barLoc, vertical, hashShow, labelsShow, valueShow, hashStart, labelsStart, hashSpacing, labelsSpacing, xHash, yHash, xPixel, yPixel, big, barC

Constructors
ClickableMeter

Methods
display, checkForClick, calcLoc, setValue, calcVal, showLabels, showLabels, showHashmarks, showHashmarks, showValue, textLabel, getValue, getMaxValue, getMinValue


Inherited from ClickablePanel

Fields
clickX, clickY, invisible, wholeSkectch

Constructors
ClickablePanel, ClickablePanel, ClickablePanel

Methods
adjustPanel, checkForClick, display, drawOnPanel, getClickX, getClickY, getPanelX, getPanelY, isOver, setClickX, setClickY, setColor


Inherited from Clickable

Fields
NOTHING_CLICKED, COMBO_BUTTON, DISABLED_COLOR, borderColor, c, clicked, clickedItemNum, colorState, enabled, h, label, over, overC, scrollable, selected, selectedItemNum, visible, w, x, y

Constructors
Clickable

Methods
checkForClick, display, doNotSelect, getClickedItemNum, getColorState, getH, getItem, getLabel, getSelected, getSelectedItem, getSelectedItemLabel, getSelectedItemNum, getW, getX, getY, hasBeenClicked, hideSomething, isOver, setBorderColor, setColorState, setH, setLabel, setScrollable, setSelected, setSelectedItemNum, setEnabled, setVisible, setW, setX, setY, sX, sY

Return to the top of the page

Revised: 04/11/2014