}
}
public void deiconifyFrame(JInternalFrame frame) {
if (frame.getClientProperty(TABBED_PANE_PROPERTY) != null) {
JDesktopIcon icon = frame.getDesktopIcon();
Container parent = icon.getParent();
if (parent != null) {
parent.remove(icon);
}
frame.setVisible(true);
DockingTabbedPane tabbedPane = (DockingTabbedPane)frame.getClientProperty(TABBED_PANE_PROPERTY);
handleAddTab(tabbedPane);
frame.putClientProperty(TABBED_PANE_PROPERTY, null);
tabbedPane.addTab(frame);
if (frame.isMaximum()) {
DockLayout layout = (DockLayout)parent.getLayout();
layout.maximizeLayoutComponent(tabbedPane);
((JLayeredPane)parent).moveToFront(tabbedPane);
}
handleRemoveLastTab(tabbedPane); //In certain circumstances the added tab was the first
setSelected(frame);
} else {
JDesktopIcon icon = frame.getDesktopIcon();
Container parent = icon.getParent();
JInternalFrame maximizedFrame = null;
for (Component component: parent.getComponents()) {
maximizedFrame = getInternalFrame(component);
if (maximizedFrame != null && maximizedFrame.isVisible() && maximizedFrame.isMaximum()) {
break;