if(!hasAlreadyListener(edit, rg_listener)){
edit.addInternalFrameListener(rg_listener);
}
}
toAdd.setVisible(true);
toAdd.validate();
try { // to activate the JInternalFrame
toAdd.setSelected(true);
} catch (PropertyVetoException e) { // if some component does not like this
toAdd.moveToFront(); // then move it to front without activating
}