=== modified file 'src/com/goldencode/p2j/ui/client/gui/FrameGuiImpl.java' --- src/com/goldencode/p2j/ui/client/gui/FrameGuiImpl.java 2016-08-18 19:36:02 +0000 +++ src/com/goldencode/p2j/ui/client/gui/FrameGuiImpl.java 2016-08-19 18:16:52 +0000 @@ -75,7 +75,8 @@ ** 038 HC 20160628 Prevented unhandled exceptions when window/frame closed/destroyed. ** 039 EVL 20160622 Adding refresh dialog title after config update. ** 040 SBI 20160713 Fixed the cursor if the mouse pointer over labels. -** 041 SBI 20160818 Fixed the look and feel for empty frames according to the Progress 4GL GUI. +** 041 SBI 20160818 Fixed the look and feel for frames according to the Progress 4GL GUI minimal +** frame size. */ package com.goldencode.p2j.ui.client.gui; @@ -103,8 +104,8 @@ public class FrameGuiImpl extends Frame { - /** The frame's default size given in pixels */ - private static final int DEFAULT_SIZE_IN_PIXELS = 16; + /** The frame's minimal size given in pixels */ + private static final int DEFAULT_MINIMAL_SIZE_IN_PIXELS = 16; /** Screen driver */ private GuiDriver gd; @@ -136,11 +137,11 @@ /** Keeping track on explicit virtual height setting. */ private boolean explicitVirtualHeight = false; - /** The default width of the empty frame. */ - private final double defaultWidth; + /** The default minimal width of the empty frame. */ + private final double defaultMinimalWidth; - /** The default height of the empty frame. */ - private final double defaultHeight; + /** The default minimal height of the empty frame. */ + private final double defaultMinimalHeight; /** * Special constructor used to restore component using given configuration. @@ -173,8 +174,8 @@ cc = screen.coordinates(); // calculates the frame's default size from its pixels size - defaultHeight = cc.heightFromNative(DEFAULT_SIZE_IN_PIXELS); - defaultWidth = cc.widthFromNative(DEFAULT_SIZE_IN_PIXELS); + defaultMinimalHeight = cc.heightFromNative(DEFAULT_MINIMAL_SIZE_IN_PIXELS); + defaultMinimalWidth = cc.widthFromNative(DEFAULT_MINIMAL_SIZE_IN_PIXELS); } /** @@ -495,15 +496,15 @@ super.realizeFrame(realize); if (realize) { - AbstractContainer container = getContentPane(); - if (container != null) + double currentWidth = width(); + double currentHeight = height(); + if (currentWidth < defaultMinimalWidth || currentHeight < defaultMinimalHeight) { - // if this frame has no widgets and its dimension is not set, - // then set its default dimension. - if (container.widgets().length == 0 && !config().fixedWidth && !config().fixedHeight) - { - setOuterSize(defaultWidth, defaultHeight); - } + currentWidth = Math.max(currentWidth, defaultMinimalWidth); + currentHeight = Math.max(currentHeight, defaultMinimalHeight); + setOuterSize(currentWidth, currentHeight); + config().widthChars = currentWidth; + config().heightChars = currentHeight; } } } @@ -632,6 +633,12 @@ if (!explicitVirtualHeight) { super.calculateHeight(d, delta); + // fix the calculated inner size + double minimalInnerHeight = defaultMinimalHeight - calculateHeightDelta(); + if (d.height < minimalInnerHeight) + { + d.height = minimalInnerHeight; + } } else if (config().virtualHeightChars != BaseConfig.INV_COORD) {