mirror of
https://github.com/magefree/mage.git
synced 2025-12-25 21:12:04 -08:00
* 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:
parent
3a57485501
commit
87f919ecac
12 changed files with 232 additions and 63 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue