fix bad import, AGAIN.
[nikiroo-utils.git] / ui / UIUtils.java
index 51766d3d48b77e2cbe878bc20f90296f4660ac4c..892c6cbb02ee3268853d9895c38d94fc045684f3 100644 (file)
@@ -10,7 +10,9 @@ import java.awt.GraphicsConfiguration;
 import java.awt.GraphicsDevice;
 import java.awt.GraphicsEnvironment;
 import java.awt.Paint;
+import java.awt.Point;
 import java.awt.RadialGradientPaint;
+import java.awt.Rectangle;
 import java.awt.RenderingHints;
 import java.awt.Window;
 import java.io.IOException;
@@ -372,7 +374,7 @@ public class UIUtils {
        }
 
        /**
-        * Set the given {@link windows} to full screen mode, on the desktop it
+        * Set the given {@link Window} to full screen mode, on the desktop it
         * currently resides on.
         * <p>
         * Can be cancelled by calling again with a NULL value.
@@ -394,12 +396,15 @@ public class UIUtils {
 
                        return;
                }
+               
+               Rectangle r = win.getBounds();
+               Point center = new Point(r.x + r.width / 2, r.y + r.height / 2);
 
                GraphicsDevice current = null;
                for (GraphicsDevice screen : screens) {
                        GraphicsConfiguration[] confs = screen.getConfigurations();
                        for (GraphicsConfiguration conf : confs) {
-                               if (conf.getBounds().contains(win.getBounds())) {
+                               if (conf.getBounds().contains(center)) {
                                        current = screen;
                                        break;
                                }