X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTWindow.java;h=65eaa4835d342e00d1cf7065b44c5eea1b20bcce;hb=a83fea2bae838f4b9bbf59ce3832e0e67be41378;hp=e15092e5c07c29894be0cfa08e182914765689c4;hpb=2b9c27db318b916730aa04f2b41bd3bff795a5dc;p=fanfix.git diff --git a/src/jexer/TWindow.java b/src/jexer/TWindow.java index e15092e..65eaa48 100644 --- a/src/jexer/TWindow.java +++ b/src/jexer/TWindow.java @@ -187,6 +187,15 @@ public class TWindow extends TWidget { private int restoreWindowX; private int restoreWindowY; + /** + * Set the maximum width for this window. + * + * @param maximumWindowWidth new maximum width + */ + public final void setMaximumWindowWidth(final int maximumWindowWidth) { + this.maximumWindowWidth = maximumWindowWidth; + } + /** * Public constructor. Window will be located at (0, 0). * @@ -742,22 +751,30 @@ public class TWindow extends TWidget { } } if (keypress.equals(kbShiftLeft)) { - if (getWidth() > minimumWindowWidth) { + if ((getWidth() > minimumWindowWidth) + || (minimumWindowWidth <= 0) + ) { setWidth(getWidth() - 1); } } if (keypress.equals(kbShiftRight)) { - if (getWidth() < maximumWindowWidth) { + if ((getWidth() < maximumWindowWidth) + || (maximumWindowWidth <= 0) + ) { setWidth(getWidth() + 1); } } if (keypress.equals(kbShiftUp)) { - if (getHeight() > minimumWindowHeight) { + if ((getHeight() > minimumWindowHeight) + || (minimumWindowHeight <= 0) + ) { setHeight(getHeight() - 1); } } if (keypress.equals(kbShiftDown)) { - if (getHeight() < maximumWindowHeight) { + if ((getHeight() < maximumWindowHeight) + || (maximumWindowHeight <= 0) + ) { setHeight(getHeight() + 1); } }