X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=ui%2FUIUtils.java;h=892c6cbb02ee3268853d9895c38d94fc045684f3;hb=34835dd204994ab0be1899848c4de2f9dde9f766;hp=39d73c59c3c87244fb50c2af97961c775a752e67;hpb=66c20ee9c257fa01780e9225a2dd46f0ac7bb901;p=nikiroo-utils.git diff --git a/ui/UIUtils.java b/ui/UIUtils.java index 39d73c5..892c6cb 100644 --- a/ui/UIUtils.java +++ b/ui/UIUtils.java @@ -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; @@ -27,8 +29,6 @@ import javax.swing.UnsupportedLookAndFeelException; import javax.swing.event.HyperlinkEvent; import javax.swing.event.HyperlinkListener; -import com.sun.java.swing.plaf.windows.resources.windows; - import be.nikiroo.utils.Version; import be.nikiroo.utils.VersionCheck; @@ -374,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. *

* Can be cancelled by calling again with a NULL value. @@ -396,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; }