From 7114731dfeaadc52d937f4db7531e792ed1a53ff Mon Sep 17 00:00:00 2001 From: tkellner Date: Wed, 12 Dec 2012 08:17:13 +0000 Subject: Set base applet size based on actual size git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@1156 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../src/main/java/at/gv/egiz/bku/gui/BKUGUIImpl.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'BKUCommonGUI/src/main/java/at/gv/egiz/bku') 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; } -- cgit v1.2.3