From b677e1f2a6dfd554f11a7a24fe146f92cebf56eb Mon Sep 17 00:00:00 2001 From: Timur Saglam Date: Sun, 2 Aug 2020 13:35:47 +0200 Subject: [PATCH] FIX: Fixed UI bug on Windows 10 where the preview UI was not scaling well when using the Windows UI scale settings. Windows 10 uses a very primitive UI scaling approach to deal with high-DPI, which works only somewhat well. --- src/main/java/carcassonne/view/secondary/PreviewGUI.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/carcassonne/view/secondary/PreviewGUI.java b/src/main/java/carcassonne/view/secondary/PreviewGUI.java index 1307af97..ab21170a 100644 --- a/src/main/java/carcassonne/view/secondary/PreviewGUI.java +++ b/src/main/java/carcassonne/view/secondary/PreviewGUI.java @@ -49,7 +49,7 @@ public PreviewGUI(MainController controller, MainGUI ui) { super(controller, ui); buildContent(); pack(); - selectionSize = buttonSkip.getWidth() + buttonRotateLeft.getWidth() + buttonRotateRight.getWidth() - VERTICAL_SPACE; + selectionSize = dialogPanel.getWidth() - VERTICAL_SPACE; defaultSize = (int) (selectionSize * SELECTION_FACTOR); } @@ -150,13 +150,13 @@ private void buildContent() { buttonRotateRight.addMouseListener((MouseClickListener) event -> rotateRight()); // set constraints: GridBagConstraints constraints = new GridBagConstraints(); - constraints.fill = GridBagConstraints.NONE; + constraints.fill = GridBagConstraints.VERTICAL; + constraints.weightx = 1; // keeps buttons evenly positioned. // add buttons: dialogPanel.add(buttonRotateLeft, constraints); dialogPanel.add(buttonSkip, constraints); dialogPanel.add(buttonRotateRight, constraints); // change constraints and add label: - constraints.fill = GridBagConstraints.VERTICAL; constraints.gridy = 1; constraints.gridwidth = 3; ImageIcon defaultImage = new Tile(TileType.Null).getScaledIcon(50);