ACOP CheckBox

AcopCheckBox

Description

AcopCheckBox is a JCheckBox extension for displaying and switching between two values. User can specify the values: one for "selected" and one for "deselected. If remote connection point is equal to the former one, than check box appear selected; if it is equal to the latter, than check box appear deselected; if none of them, it set to WARNING state. If user changes selection, proper value is sent also to remote connection point.

Code examples

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

Common features

For features shared with other ACOP Beans see this page.

Set selected/deselected values

To set the vales, e.g. selected to 10 and deselected to 5, we execute following code:

checkBox.setSelectedValue(10);
checkBox.setDeselectedValue(5);

Or if we want just to read them:

checkBox.getSelectedValue();
checkBox.getDeselectedValue();

Set text on the CheckBox

To set the text on the CheckBox to something else, e.g. "PowerSuppy on", we simply call:

checkBox.setText("PowerSuppy on");

Other properties

Other properties of the CheckBox can also simply be adjusted by calling the appropriate setter methods. These properties include background/foreground color, font etc:

checkBox.setBackground(Color.RED);
checkBox.setForeground(Color.GREEN);
checkBox.setFont(CheckBox.getFont().deriveFont(24f));

Complete source code for examples

See the complete source code used in this examples.