throw new RuntimeException("Unknown target JPanel");
}
GroupLayout oldLayout = (GroupLayout) sharedPanel.getParent().getLayout();
oldLayout.replace(sharedPanel, sharedPanelPlaceHolder);
GroupLayout newLayout = (GroupLayout) p.getLayout();
newLayout.replace(toReplace, sharedPanel);
oldLayout.replace(sharedPanelPlaceHolder, toReplace);
if ((toReplace.getParent() == taskPanel)) {
taskLastSharedPanelPlaceHolder = toReplace;
} else if ((toReplace.getParent() == manualControlPanel)) {
manualLastSharedPanelPlaceHolder = toReplace;