maximized window instead of fullscreen

This commit is contained in:
Patrick Haßel 2023-02-26 13:59:13 +01:00
parent 42db19b253
commit e15cc147c2

View File

@ -13,8 +13,6 @@ import static de.ph87.kindermalen.util.MyGridBagConstraints.C;
public class Window extends JFrame {
public static final int SCREEN = 1;
private final Drawing drawing = new Drawing(1920, 1080);
public static void main(String[] args) {
@ -34,7 +32,7 @@ public class Window extends JFrame {
pack();
setFullscreen();
setExtendedState(getExtendedState() | MAXIMIZED_BOTH);
setDefaultCloseOperation(EXIT_ON_CLOSE);
KeyboardFocusManager.getCurrentKeyboardFocusManager()
@ -55,19 +53,4 @@ public class Window extends JFrame {
);
}
private void setFullscreen() {
final GraphicsEnvironment graphicsEnvironment = GraphicsEnvironment.getLocalGraphicsEnvironment();
final GraphicsDevice[] graphicsDevices = graphicsEnvironment.getScreenDevices();
final GraphicsDevice graphicsDevice;
if (SCREEN < graphicsDevices.length) {
graphicsDevice = graphicsDevices[SCREEN];
} else if (graphicsDevices.length > 0) {
graphicsDevice = graphicsDevices[0];
} else {
throw new RuntimeException("No Screens Found");
}
graphicsDevice.setFullScreenWindow(this);
// setPreferredSize(new Dimension(graphicsDevice.getDisplayMode().getWidth(),graphicsDevice.getDisplayMode().getHeight()));
}
}