X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fgui%2FAquaInternalFrameManager.java;h=8ef204c832315f97adc2d9c202d8243da4f7bc88;hb=da11f432f67f80f1848d75f862495e5e9dd9076b;hp=b96892b08aa5b22be40ca4cc0c01b2c375eccf4c;hpb=30ffb528a75d620eff65932c9f127e75113ac464;p=jalview.git diff --git a/src/jalview/gui/AquaInternalFrameManager.java b/src/jalview/gui/AquaInternalFrameManager.java index b96892b..8ef204c 100644 --- a/src/jalview/gui/AquaInternalFrameManager.java +++ b/src/jalview/gui/AquaInternalFrameManager.java @@ -26,11 +26,11 @@ package jalview.gui; import java.awt.Container; -import java.awt.Rectangle; import java.beans.PropertyVetoException; import java.util.Vector; import javax.swing.DefaultDesktopManager; +import javax.swing.DesktopManager; import javax.swing.JInternalFrame; /** @@ -60,7 +60,7 @@ import javax.swing.JInternalFrame; * around to the bottom of the window stack (as the original implementation * does) * - * @see com.sun.java.swing.plaf.windows.WindowsDesktopManager + * see com.sun.java.swing.plaf.windows.WindowsDesktopManager */ public class AquaInternalFrameManager extends DefaultDesktopManager { @@ -82,6 +82,17 @@ public class AquaInternalFrameManager extends DefaultDesktopManager */ Vector fChildFrames = new Vector<>(1); + /** + * keep a reference to the original LAF manager so we can iconise/de-iconise + * correctly + */ + private DesktopManager ourManager; + + public AquaInternalFrameManager(DesktopManager desktopManager) + { + ourManager = desktopManager; + } + @Override public void closeFrame(final JInternalFrame f) { @@ -112,7 +123,7 @@ public class AquaInternalFrameManager extends DefaultDesktopManager // reshape does delta checks for us f.reshape(desktopIcon.getX(), desktopIcon.getY(), f.getWidth(), f.getHeight()); - super.deiconifyFrame(f); + ourManager.deiconifyFrame(f); } void addIcon(final Container c, @@ -127,25 +138,7 @@ public class AquaInternalFrameManager extends DefaultDesktopManager @Override public void iconifyFrame(final JInternalFrame f) { - // Same as super except doesn't deactivate it - JInternalFrame.JDesktopIcon desktopIcon; - Container c; - - desktopIcon = f.getDesktopIcon(); - // Position depends on *current* position of frame, unlike super which - // reuses the first position - final Rectangle r = getBoundsForIconOf(f); - desktopIcon.setBounds(r.x, r.y, r.width, r.height); - - c = f.getParent(); - if (c == null) - { - return; - } - - c.remove(f); - addIcon(c, desktopIcon); - c.repaint(f.getX(), f.getY(), f.getWidth(), f.getHeight()); + ourManager.iconifyFrame(f); } // WindowsDesktopManager code @@ -159,11 +152,12 @@ public class AquaInternalFrameManager extends DefaultDesktopManager super.activateFrame(f); } - // If this is the first activation, add to child list. - if (fChildFrames.indexOf(f) == -1) + // add or relocate to top of stack + if (fChildFrames.indexOf(f) != -1) { - fChildFrames.addElement(f); + fChildFrames.remove(f); } + fChildFrames.addElement(f); if (fCurrentFrame != null && f != fCurrentFrame) { @@ -261,4 +255,4 @@ public class AquaInternalFrameManager extends DefaultDesktopManager { switchFrame(false); } -} \ No newline at end of file +}