if (buttonGroup != null)
if (buttonGroup != null) {
    public void setSelected(boolean b) {        if (isSelected() != b) {            if (buttonGroup != null)                buttonGroup.setSelected(this, b);            super.setSelected(b);        }    }