From 190a4893d444dde29d9bc2c825b483491fa0088d Mon Sep 17 00:00:00 2001 From: jprocter Date: Mon, 21 Nov 2011 18:56:48 +0000 Subject: [PATCH] (JAL-368) ensure window never gets a negative Y coordinate when dragged or resised. --- src/jalview/gui/Desktop.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/jalview/gui/Desktop.java b/src/jalview/gui/Desktop.java index 1da4996..b6cbea3 100644 --- a/src/jalview/gui/Desktop.java +++ b/src/jalview/gui/Desktop.java @@ -204,6 +204,10 @@ public class Desktop extends jalview.jbgui.GDesktop implements public void dragFrame(JComponent f, int newX, int newY) { + if (newY<0) + { + newY=0; + } delegate.dragFrame(f, newX, newY); } @@ -240,6 +244,11 @@ public class Desktop extends jalview.jbgui.GDesktop implements public void resizeFrame(JComponent f, int newX, int newY, int newWidth, int newHeight) { + Rectangle b=desktop.getBounds(); + if (newY<0) + { + newY=0; + } delegate.resizeFrame(f, newX, newY, newWidth, newHeight); } @@ -282,12 +291,14 @@ public class Desktop extends jalview.jbgui.GDesktop implements //sp.getViewport().setView(desktop); //getContentPane().add(sp, BorderLayout.CENTER); getContentPane().add(desktop, BorderLayout.CENTER); - desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); + desktop.setDragMode(JDesktopPane.OUTLINE_DRAG_MODE); + // This line prevents Windows Look&Feel resizing all new windows to maximum // if previous window was maximised desktop.setDesktopManager(new MyDesktopManager( new DefaultDesktopManager())); + Rectangle dims = getLastKnownDimensions(""); if (dims != null) { -- 1.7.10.2