+ return widget;
+ }
+
+ /**
+ * Apply markup and set text on {@link Label}, {@link Button}, {@link Text}.
+ *
+ * @see #markup(Widget)
+ */
+ public static <T extends Widget> T text(T widget, String txt) {
+ markup(widget);
+ if (widget instanceof Label)
+ ((Label) widget).setText(txt);
+ else if (widget instanceof Button)
+ ((Button) widget).setText(txt);
+ else if (widget instanceof Text)
+ ((Text) widget).setText(txt);
+ else
+ throw new IllegalArgumentException("Unsupported widget type " + widget.getClass());
+ return widget;