ACOP Number Label

AcopNumberLabel

Description

AcopNumberLabel is a displayer which can show a single double value. The slider can be used as a component which controls settable connection points.

The component consists of a text field which shows the properly formatted value received from the remote property. When user clicks on the field he is allowed to enter a new value, which is then set to the remote property.

Code examples

The following lines show an example how to use the features of the AcopNumberLabel.

Common features

For features shared with other ACOP Beans see this page.

Value monitoring

If number label is used as a monitor, we want to be notified when the value is exceed to preset bounds. The number label may visually indicate this by tilting the border in a prescribed color:

label.setTiltingEnabled(true);
label.setOutOfBoundsColor(Color.YELLOW);

If we don't want to change the values at all (just use the label as a monitor displayer) we can put it in the read only mode

label.setEditable(false);

Setting displayed number

AcopNumberLabel can also be configured to convert current values into a desired form. For example, if we measure angle, it would be better to display value in degrees, minutes and seconds, instead of in a decimal form (10.5 converts into 10°30'). To do so, we use the AngleNumberDescriptor class:

AngleNumberDescriptor and = new AngleNumberDescriptor();
label.setNumberDescriptor(and);

Other properties

Other properties of the slider can also simply be adjusted by calling the appropriate setter methods. These properties include maximum/minimum value background/foreground color, title etc:

label.setMaximum(100);
label.setMinimum(5.2);
label.setBackground(Color.RED);
label.setForeground(Color.GREEN);

Complete source code for examples

See the complete source code used in this examples.