* Reworked handling of revealed and look at windows. Windows can stay open now and moved to a position and stay there.

This commit is contained in:
LevelX2 2015-06-21 23:49:16 +02:00
parent 3a57485501
commit 87f919ecac
12 changed files with 232 additions and 63 deletions

View file

@ -75,21 +75,26 @@ public class GuiDisplayUtil {
Dimension screenDim = c.getToolkit().getScreenSize();
GraphicsConfiguration g = c.getGraphicsConfiguration();
if (g != null) {
Insets insets = c.getToolkit().getScreenInsets(g);
Insets insets = c.getToolkit().getScreenInsets(g);
boolean setLocation = false;
if (x + c.getWidth() > screenDim.width - insets.right) {
x = (screenDim.width - insets.right) - c.getWidth();
setLocation = true;
} else if (x < insets.left) {
x = insets.left;
setLocation = true;
}
if (y + c.getHeight() > screenDim.height - insets.bottom) {
y = (screenDim.height - insets.bottom) - c.getHeight();
setLocation = true;
} else if (y < insets.top) {
y = insets.top;
setLocation = true;
}
if (setLocation) {
c.setLocation(x, y);
}
c.setLocation(x, y);
} else {
System.out.println("GuiDisplayUtil::keepComponentInsideScreen -> no GraphicsConfiguration");
}