maximized window instead of fullscreen
This commit is contained in:
parent
42db19b253
commit
e15cc147c2
@ -13,8 +13,6 @@ import static de.ph87.kindermalen.util.MyGridBagConstraints.C;
|
|||||||
|
|
||||||
public class Window extends JFrame {
|
public class Window extends JFrame {
|
||||||
|
|
||||||
public static final int SCREEN = 1;
|
|
||||||
|
|
||||||
private final Drawing drawing = new Drawing(1920, 1080);
|
private final Drawing drawing = new Drawing(1920, 1080);
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
@ -34,7 +32,7 @@ public class Window extends JFrame {
|
|||||||
|
|
||||||
pack();
|
pack();
|
||||||
|
|
||||||
setFullscreen();
|
setExtendedState(getExtendedState() | MAXIMIZED_BOTH);
|
||||||
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
setDefaultCloseOperation(EXIT_ON_CLOSE);
|
||||||
|
|
||||||
KeyboardFocusManager.getCurrentKeyboardFocusManager()
|
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()));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user