From: jprocter Date: Mon, 21 Nov 2011 18:56:48 +0000 (+0000) Subject: (JAL-368) ensure window never gets a negative Y coordinate when dragged or resised. X-Git-Tag: Archived_Release_2_7~15^2 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=190a4893d444dde29d9bc2c825b483491fa0088d;p=jalview.git (JAL-368) ensure window never gets a negative Y coordinate when dragged or resised. --- 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) {