(JAL-368) ensure window never gets a negative Y coordinate when dragged or resised.
authorjprocter <jprocter@compbio.dundee.ac.uk>
Mon, 21 Nov 2011 18:56:48 +0000 (18:56 +0000)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Mon, 21 Nov 2011 18:56:48 +0000 (18:56 +0000)
src/jalview/gui/Desktop.java

index 1da4996..b6cbea3 100644 (file)
@@ -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)
     {