[Schmitzm-commits] r1790 - trunk/schmitzm-core/src/main/java/de/schmitzm/swing

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Nov 21 19:27:34 CET 2011


Author: mojays
Date: 2011-11-21 19:27:34 +0100 (Mon, 21 Nov 2011)
New Revision: 1790

Modified:
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/AbstractActionTextPanel.java
   trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java
Log:
SwingUtil.setRelativeFramePosition(.) avoid negative frame position
AbstractActionTextPanel: providing access to panel button

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/AbstractActionTextPanel.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/AbstractActionTextPanel.java	2011-11-21 18:00:34 UTC (rev 1789)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/AbstractActionTextPanel.java	2011-11-21 18:27:34 UTC (rev 1790)
@@ -121,6 +121,13 @@
   }
   
   /**
+   * Returns the button of the panel.
+   */
+  public JButton getActionButton() {
+    return button;
+  }
+  
+  /**
    * Called by the {@link #buttonAction} with {@link #getText()} as
    * parameter.
    */

Modified: trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java
===================================================================
--- trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java	2011-11-21 18:00:34 UTC (rev 1789)
+++ trunk/schmitzm-core/src/main/java/de/schmitzm/swing/SwingUtil.java	2011-11-21 18:27:34 UTC (rev 1790)
@@ -540,13 +540,13 @@
 			frameSize.width = screenSize.width;
 		}
 		// Fenster positionieren
-		window.setLocation(
-				relLocation.x
-						+ Math.round((relSize.width - frameSize.width)
-								* (float) relX),
-				relLocation.y
-						+ Math.round((relSize.height - frameSize.height)
-								* (float) relY));
+		int x = relLocation.x
+    		  + Math.round((relSize.width - frameSize.width) * (float) relX);
+        int y = relLocation.y
+              + Math.round((relSize.height - frameSize.height) * (float) relY);
+        x = Math.max(x, 0);
+        y = Math.max(y, 0);
+        window.setLocation(x,y);
 	}
 
 	/**



More information about the Schmitzm-commits mailing list