#46 BoxLayoutManager working
[fanfix.git] / src / jexer / TWidget.java
index 9dd21c1a08e9fa18d341fe310f7d1ac1c9aa894e..d48ffe4c9ad6e477123c1e940e659360b347a1ab 100644 (file)
@@ -577,7 +577,12 @@ public abstract class TWidget implements Comparable<TWidget> {
             width = resize.getWidth();
             height = resize.getHeight();
             if (layout != null) {
-                layout.onResize(resize);
+                if (this instanceof TWindow) {
+                    layout.onResize(new TResizeEvent(TResizeEvent.Type.WIDGET,
+                            width - 2, height - 2));
+                } else {
+                    layout.onResize(resize);
+                }
             }
         } else {
             // Let children see the screen resize
@@ -2487,4 +2492,19 @@ public abstract class TWidget implements Comparable<TWidget> {
             gridRows);
     }
 
+    /**
+     * Convenience function to add a panel to this container/window.
+     *
+     * @param x column relative to parent
+     * @param y row relative to parent
+     * @param width width of text area
+     * @param height height of text area
+     * @return the new panel
+     */
+    public final TPanel addPanel(final int x, final int y, final int width,
+        final int height) {
+
+        return new TPanel(this, x, y, width, height);
+    }
+
 }