diff options
-rw-r--r-- | BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java index 1f6e849e..4074978b 100644 --- a/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java +++ b/BKUCommonGUI/src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java @@ -2417,13 +2417,20 @@ public class BKUGUIImpl implements BKUGUIFacade { || baseHeight == 0) { // first call - determine base width and height - baseWidth = contentPanel.getWidth(); - baseHeight = contentPanel.getHeight(); + int width = contentPanel.getWidth(); + int height = contentPanel.getHeight(); + float ratio = ((float) width / height); + baseWidth = width < 166 ? width : 166; + baseHeight = (int) (baseWidth / ratio); + if (baseHeight > height) { + baseHeight = height; + baseWidth = (int) (baseHeight * ratio); + } + log.debug("Original gui size: " + width + "x" + height + + " - Base: " + baseWidth + "x" + baseHeight); } - float factor = (float) contentPanel.getSize().getWidth() - / (float) baseWidth; - + float factor = (float) contentPanel.getSize().getWidth() / baseWidth; return factor; } |