summaryrefslogtreecommitdiffstats
path: root/dozentenmodul/src/main/java
diff options
context:
space:
mode:
authorJonathan Bauer2014-09-17 14:06:46 +0200
committerJonathan Bauer2014-09-17 14:06:46 +0200
commitc95f6cf24fda2f8a79609e01baf5b5b75f6b6792 (patch)
tree0002e434dace2ca0661679a7387595f4411d4c1a /dozentenmodul/src/main/java
parent[client] center GUIs in the primary display only (diff)
downloadtutor-module-c95f6cf24fda2f8a79609e01baf5b5b75f6b6792.tar.gz
tutor-module-c95f6cf24fda2f8a79609e01baf5b5b75f6b6792.tar.xz
tutor-module-c95f6cf24fda2f8a79609e01baf5b5b75f6b6792.zip
Revert "[client] center GUIs in the primary display only"
This reverts commit dad8d7d51aedeb50bfa8d12cac7220ea7c0c4a47.
Diffstat (limited to 'dozentenmodul/src/main/java')
-rw-r--r--dozentenmodul/src/main/java/util/GuiOrganizer.java19
1 files changed, 6 insertions, 13 deletions
diff --git a/dozentenmodul/src/main/java/util/GuiOrganizer.java b/dozentenmodul/src/main/java/util/GuiOrganizer.java
index edc16cef..5d6b2de8 100644
--- a/dozentenmodul/src/main/java/util/GuiOrganizer.java
+++ b/dozentenmodul/src/main/java/util/GuiOrganizer.java
@@ -1,26 +1,19 @@
package util;
+import java.awt.Dimension;
+import java.awt.Toolkit;
import java.awt.Window;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Display;
public abstract class GuiOrganizer {
/* receive GUI, set it to center of the screen */
public static void centerGUI(Window gui) {
-
- Display display = new Display();
-
- // detect bounds of primary display.
- Rectangle rect = display.getPrimaryMonitor().getBounds();
-
- // without this, we get an expection, not sure what this does though :)
- display.dispose();
-
- double width = rect.width;
- double height = rect.height;
+ Dimension dm = Toolkit.getDefaultToolkit().getScreenSize();
+ double width = dm.getWidth();
+ double height = dm.getHeight();
double xPosition = (width / 2 - gui.getWidth() / 2);
double yPosition = (height / 2 - gui.getHeight() / 2);
gui.setLocation((int) xPosition, (int) yPosition);
}
+
}