diff options
author | Jonathan Bauer | 2015-03-20 11:31:08 +0100 |
---|---|---|
committer | Jonathan Bauer | 2015-03-20 11:31:08 +0100 |
commit | ff3ed26fb0e59168e61ad424fae9102095eb72ac (patch) | |
tree | 9c60d74c787592c6e4f4f43648e0d5da5faa4519 | |
parent | [client] fix the fix :) thx simon (diff) | |
download | tutor-module-ff3ed26fb0e59168e61ad424fae9102095eb72ac.tar.gz tutor-module-ff3ed26fb0e59168e61ad424fae9102095eb72ac.tar.xz tutor-module-ff3ed26fb0e59168e61ad424fae9102095eb72ac.zip |
[client] center popups relative to main window current position
-rw-r--r-- | dozentenmodul/src/main/java/util/GuiManager.java | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/dozentenmodul/src/main/java/util/GuiManager.java b/dozentenmodul/src/main/java/util/GuiManager.java index 4b8b610e..1f7b47cc 100644 --- a/dozentenmodul/src/main/java/util/GuiManager.java +++ b/dozentenmodul/src/main/java/util/GuiManager.java @@ -262,7 +262,9 @@ public abstract class GuiManager { LOGGER.error("Popup classes need to be JFrame, given a: " + popup.getClass().getName()); return; } - ((JFrame)popup).setLocation((int)(rect.getWidth() / 2 - popup.getWidth() / 2), (int)(rect.getHeight() / 2 - popup.getHeight() / 2)); + int xPopup = (int) (mainWindow.getX() + (mainWindow.getWidth() / 2) - (popup.getWidth() / 2)); + int yPopup = (int) (mainWindow.getY() + (mainWindow.getHeight() / 2) - (popup.getHeight() / 2)); + ((JFrame)popup).setLocation(xPopup, yPopup); ((JFrame)popup).setVisible(true); } } |