import java.util.List;
import java.util.ArrayList;
+import jexer.backend.Screen;
import jexer.bits.ColorTheme;
import jexer.event.TCommandEvent;
import jexer.event.TInputEvent;
import jexer.event.TMenuEvent;
import jexer.event.TMouseEvent;
import jexer.event.TResizeEvent;
-import jexer.io.Screen;
import jexer.menu.TMenu;
import static jexer.TKeypress.*;
}
}
+ /**
+ * Repaint the screen on the next update.
+ */
+ public void doRepaint() {
+ window.getApplication().doRepaint();
+ }
+
// ------------------------------------------------------------------------
// Constructors -----------------------------------------------------------
// ------------------------------------------------------------------------
* @param resize resize event
*/
public void onResize(final TResizeEvent resize) {
- // Default: do nothing, pass to children instead
- for (TWidget widget: children) {
- widget.onResize(resize);
+ // Default: change my width/height.
+ if (resize.getType() == TResizeEvent.Type.WIDGET) {
+ width = resize.getWidth();
+ height = resize.getHeight();
+ } else {
+ // Let children see the screen resize
+ for (TWidget widget: children) {
+ widget.onResize(resize);
+ }
}
}
/**
* Method that subclasses can override to do processing when the UI is
- * idle.
+ * idle. Note that repainting is NOT assumed. To get a refresh after
+ * onIdle, call doRepaint().
*/
public void onIdle() {
// Default: do nothing, pass to children instead
return new TText(this, text, x, y, width, height, "ttext");
}
+ /**
+ * Convenience function to add an editable text area box to this
+ * container/window.
+ *
+ * @param text text on the screen
+ * @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 text box
+ */
+ public final TEditorWidget addEditor(final String text, final int x,
+ final int y, final int width, final int height) {
+
+ return new TEditorWidget(this, text, x, y, width, height);
+ }
+
/**
* Convenience function to spawn a message box.
*