/** * Sets the state of this check box to the specified state. The boolean value <code>true</code> * indicates the "on" state, and <code>false</code> indicates the "off" state. * * <p>Note that this method should be primarily used to initialize the state of the checkbox. * Programmatically setting the state of the checkbox will <i>not</i> trigger an <code>ItemEvent * </code>. The only way to trigger an <code>ItemEvent</code> is by user interaction. * * @param state the boolean state of the check box * @see #getState */ public void setState(boolean state) { /* Cannot hold check box lock when calling group.setSelectedCheckbox. */ CheckboxGroup group = this.group; if (group != null) { if (state) { group.setSelectedCheckbox(this); } else if (group.getSelectedCheckbox() == this) { state = true; } } setStateInternal(state); }