diff options
author | tkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2012-12-12 08:17:13 +0000 |
---|---|---|
committer | tkellner <tkellner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2012-12-12 08:17:13 +0000 |
commit | 7114731dfeaadc52d937f4db7531e792ed1a53ff (patch) | |
tree | 2aba37b6f53e36c8aa828ce46a56af9b4eaf409f /BKUCommonGUI/src | |
parent | 36de3d02abd09e4f1889d42a6ffbfd670afe37cd (diff) | |
download | mocca-7114731dfeaadc52d937f4db7531e792ed1a53ff.tar.gz mocca-7114731dfeaadc52d937f4db7531e792ed1a53ff.tar.bz2 mocca-7114731dfeaadc52d937f4db7531e792ed1a53ff.zip |
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
Diffstat (limited to 'BKUCommonGUI/src')
-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; } |