}
final Point location = new Point(selectedElement.getLocation());
selectedElement.disconnect();
selectedElement.getLayoutAllocation().deallocate();
selectedElement.getParent().remove(selectedElement);
final FormattedField newElement = new FormattedField();
newElement.setFieldName(record.getName());
newElement.setRecord(record);
addField(newElement);
// queue up request to set location so it happens after addField
SwingUtilities.invokeLater(new Runnable() {
public void run() {
newElement.setLocation(location);
}
});
record.addStateReceiver(newElement);
}