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.
The following lines show an example how to use the features of the AcopCheckBox.
For features shared with other ACOP Beans see this page.
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();
To set the text on the CheckBox to something else, e.g. "PowerSuppy on", we simply call:
checkBox.setText("PowerSuppy on");
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));
See the complete source code used in this examples.