Proper window screen centering

Graph dialog proper window size
Graph dialog scroll speed increased
This commit is contained in:
Jindra Petřík
2021-01-23 15:27:28 +01:00
parent 8f856fefe4
commit 4e6b59e2ac
3 changed files with 21 additions and 3 deletions

View File

@@ -29,9 +29,11 @@ import java.awt.GraphicsConfiguration;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
import java.awt.Image;
import java.awt.Insets;
import java.awt.Rectangle;
import java.awt.SystemColor;
import java.awt.TexturePaint;
import java.awt.Toolkit;
import java.awt.Window;
import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;
@@ -356,12 +358,20 @@ public class View {
screenX = allDevices[screen].getDefaultConfiguration().getBounds().width;
screenY = allDevices[screen].getDefaultConfiguration().getBounds().height;
Insets bounds = Toolkit.getDefaultToolkit().getScreenInsets(allDevices[screen].getDefaultConfiguration());
screenX = screenX - bounds.right;
screenY = screenY - bounds.bottom;
} else {
topLeftX = allDevices[0].getDefaultConfiguration().getBounds().x;
topLeftY = allDevices[0].getDefaultConfiguration().getBounds().y;
screenX = allDevices[0].getDefaultConfiguration().getBounds().width;
screenY = allDevices[0].getDefaultConfiguration().getBounds().height;
Insets bounds = Toolkit.getDefaultToolkit().getScreenInsets(allDevices[0].getDefaultConfiguration());
screenX = screenX - bounds.right;
screenY = screenY - bounds.bottom;
}
windowPosX = ((screenX - f.getWidth()) / 2) + topLeftX;