From e15cc147c2a267ce33f8b1ba433951baa74fb086 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Ha=C3=9Fel?= Date: Sun, 26 Feb 2023 13:59:13 +0100 Subject: [PATCH] maximized window instead of fullscreen --- src/main/java/de/ph87/kindermalen/Window.java | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/src/main/java/de/ph87/kindermalen/Window.java b/src/main/java/de/ph87/kindermalen/Window.java index 084b857..c050988 100644 --- a/src/main/java/de/ph87/kindermalen/Window.java +++ b/src/main/java/de/ph87/kindermalen/Window.java @@ -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())); - } - }