public void setParent(Component parent) { Radiogroup oldgp = null; if (getParent() != null) oldgp = getRadiogroup(); super.setParent(parent); Radiogroup newgp = null; if (parent != null) newgp = getRadiogroup(); if (oldgp != newgp) { if (oldgp != null) { //removed from the component tree if (_explictGroup && oldgp == _group) { _group.removeExternal(this); _attachExternal = false; } } if (newgp != null) { if (_explictGroup && !_attachExternal && newgp == _group) { _group.addExternal(this); _attachExternal = true; } } } }