X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTWidget.java;fp=src%2Fjexer%2FTWidget.java;h=8a49c816ac1ceb8ab847cadeef41f25b3cc30d9f;hb=5d26b50423486b1e680e3adfc0054f6fd0bbcefe;hp=c9e0dedc2b652e60a308b5f7a7104d739fd7242c;hpb=656c0dddc7c0faddd62d373f22916107d322429e;p=fanfix.git diff --git a/src/jexer/TWidget.java b/src/jexer/TWidget.java index c9e0ded..8a49c81 100644 --- a/src/jexer/TWidget.java +++ b/src/jexer/TWidget.java @@ -204,6 +204,13 @@ public abstract class TWidget implements Comparable { protected TWidget(final TWidget parent, final boolean enabled, final int x, final int y, final int width, final int height) { + if (width < 0) { + throw new IllegalArgumentException("width cannot be negative"); + } + if (height < 0) { + throw new IllegalArgumentException("height cannot be negative"); + } + this.enabled = enabled; this.parent = parent; this.window = parent.window; @@ -234,6 +241,13 @@ public abstract class TWidget implements Comparable { protected final void setupForTWindow(final TWindow window, final int x, final int y, final int width, final int height) { + if (width < 0) { + throw new IllegalArgumentException("width cannot be negative"); + } + if (height < 0) { + throw new IllegalArgumentException("height cannot be negative"); + } + this.parent = window; this.window = window; this.x = x;