From 5690135d1d2698b96439eaed0eaf2fff325448df Mon Sep 17 00:00:00 2001 From: gmungoc Date: Thu, 10 Dec 2020 16:01:51 +0000 Subject: [PATCH] JAL-1713 read/set OverviewPanel geometry on parent JInternalFrame --- src/jalview/project/Jalview2XML.java | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/jalview/project/Jalview2XML.java b/src/jalview/project/Jalview2XML.java index 16c324d..2c8793c 100644 --- a/src/jalview/project/Jalview2XML.java +++ b/src/jalview/project/Jalview2XML.java @@ -25,7 +25,6 @@ import static jalview.math.RotatableMatrix.Axis.Y; import static jalview.math.RotatableMatrix.Axis.Z; import java.awt.Color; -import java.awt.Dimension; import java.awt.Font; import java.awt.Rectangle; import java.io.BufferedReader; @@ -1454,7 +1453,10 @@ public class Jalview2XML if (ov != null) { Overview overview = new Overview(); - Rectangle bounds = ov.getBounds(); + JInternalFrame frame = (JInternalFrame) SwingUtilities + .getAncestorOfClass(JInternalFrame.class, ov); + overview.setTitle(frame.getTitle()); + Rectangle bounds = frame.getBounds(); overview.setXpos(bounds.x); overview.setYpos(bounds.y); overview.setWidth(bounds.width); @@ -1463,9 +1465,6 @@ public class Jalview2XML overview.setGapColour(ov.getCanvas().getGapColour().getRGB()); overview.setResidueColour(ov.getCanvas().getResidueColour().getRGB()); overview.setHiddenColour(ov.getCanvas().getHiddenColour().getRGB()); - String title = ((JInternalFrame) SwingUtilities - .getAncestorOfClass(JInternalFrame.class, ov)).getTitle(); - overview.setTitle(title); view.setOverview(overview); } if (av.getGlobalColourScheme() instanceof jalview.schemes.UserColourScheme) @@ -4075,17 +4074,15 @@ public class Jalview2XML { OverviewPanel overviewPanel = af .openOverviewPanel(overview.isShowHidden()); - overviewPanel.setBounds(overview.getXpos(), overview.getYpos(), + JInternalFrame frame = (JInternalFrame) SwingUtilities + .getAncestorOfClass(JInternalFrame.class, overviewPanel); + frame.setTitle(overview.getTitle()); + frame.setBounds(overview.getXpos(), overview.getYpos(), overview.getWidth(), overview.getHeight()); - overviewPanel.setPreferredSize( - new Dimension(overview.getWidth(), overview.getHeight())); Color gap = new Color(overview.getGapColour()); Color residue = new Color(overview.getResidueColour()); Color hidden = new Color(overview.getHiddenColour()); overviewPanel.getCanvas().setColours(gap, residue, hidden); - ((JInternalFrame) SwingUtilities - .getAncestorOfClass(JInternalFrame.class, overviewPanel)) - .setTitle(overview.getTitle()); } } -- 1.7.10.2