From 0725e0e5ff41cf03ad744579921061ccdcce74df Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 29 Jul 2022 11:36:52 +0100 Subject: [PATCH] JAL-4055 quick patch to see how Jalview looks as a free-floating multiwindowed app rather than a Desktop contained app --- src/jalview/gui/Desktop.java | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 3ad5384..9681198 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -81,6 +81,7 @@ import javax.swing.JCheckBox; import javax.swing.JComboBox; import javax.swing.JComponent; import javax.swing.JDesktopPane; +import javax.swing.JFrame; import javax.swing.JInternalFrame; import javax.swing.JLabel; import javax.swing.JMenuItem; @@ -890,15 +891,17 @@ public class Desktop extends jalview.jbgui.GDesktop int w, int h, boolean resizable, boolean ignoreMinSize) { + JFrame extFrame = new JFrame(); + extFrame.setContentPane(frame); // TODO: allow callers to determine X and Y position of frame (eg. via // bounds object). // TODO: consider fixing method to update entries in the window submenu with // the current window title - frame.setTitle(title); - if (frame.getWidth() < 1 || frame.getHeight() < 1) + extFrame.setTitle(title); + if (extFrame.getWidth() < 1 || extFrame.getHeight() < 1) { - frame.setSize(w, h); + extFrame.setSize(w, h); } // THIS IS A PUBLIC STATIC METHOD, SO IT MAY BE CALLED EVEN IN // A HEADLESS STATE WHEN NO DESKTOP EXISTS. MUST RETURN @@ -914,7 +917,7 @@ public class Desktop extends jalview.jbgui.GDesktop if (!ignoreMinSize) { - frame.setMinimumSize( + extFrame.setMinimumSize( new Dimension(DEFAULT_MIN_WIDTH, DEFAULT_MIN_HEIGHT)); // Set default dimension for Alignment Frame window. @@ -923,7 +926,7 @@ public class Desktop extends jalview.jbgui.GDesktop // I did this here in order not to miss out on any Alignment frame. if (frame instanceof AlignFrame) { - frame.setMinimumSize(new Dimension(ALIGN_FRAME_DEFAULT_MIN_WIDTH, + extFrame.setMinimumSize(new Dimension(ALIGN_FRAME_DEFAULT_MIN_WIDTH, ALIGN_FRAME_DEFAULT_MIN_HEIGHT)); } } @@ -1004,17 +1007,16 @@ public class Desktop extends jalview.jbgui.GDesktop setKeyBindings(frame); - desktop.add(frame); + // desktop.add(frame); windowMenu.add(menuItem); - frame.toFront(); + extFrame.pack(); + extFrame.setVisible(true); + extFrame.toFront(); try { - frame.setSelected(true); - frame.requestFocus(); - } catch (java.beans.PropertyVetoException ve) - { + extFrame.requestFocus(); } catch (java.lang.ClassCastException cex) { jalview.bin.Console.warn( -- 1.7.10.2