X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTWidget.java;h=25e43f71f7e651d503709214cd68d656467c0d8f;hb=128e5be1ffb65d047d8461ea1cfb65c22686ec91;hp=1ab54e29b484e4220a79a06624290aa300968701;hpb=d502a0e90eacad7ec676b0abf4686db553b794b1;p=fanfix.git diff --git a/src/jexer/TWidget.java b/src/jexer/TWidget.java index 1ab54e2..25e43f7 100644 --- a/src/jexer/TWidget.java +++ b/src/jexer/TWidget.java @@ -1023,6 +1023,7 @@ public abstract class TWidget implements Comparable { * @param y row relative to parent * @param width width of progress bar * @param value initial value of percent complete + * @return the new progress bar */ public final TProgressBar addProgressBar(final int x, final int y, final int width, final int value) { @@ -1030,4 +1031,70 @@ public abstract class TWidget implements Comparable { return new TProgressBar(this, x, y, width, value); } + /** + * Convenience function to add a radio button group to this + * container/window. + * + * @param x column relative to parent + * @param y row relative to parent + * @param label label to display on the group box + * @return the new radio button group + */ + public final TRadioGroup addRadioGroup(final int x, final int y, + final String label) { + + return new TRadioGroup(this, x, y, label); + } + + /** + * Convenience function to add a text field to this container/window. + * + * @param x column relative to parent + * @param y row relative to parent + * @param width visible text width + * @param fixed if true, the text cannot exceed the display width + * @return the new text field + */ + public final TField addField(final int x, final int y, + final int width, final boolean fixed) { + + return new TField(this, x, y, width, fixed); + } + + /** + * Convenience function to add a text field to this container/window. + * + * @param x column relative to parent + * @param y row relative to parent + * @param width visible text width + * @param fixed if true, the text cannot exceed the display width + * @param text initial text, default is empty string + * @return the new text field + */ + public final TField addField(final int x, final int y, + final int width, final boolean fixed, final String text) { + + return new TField(this, x, y, width, fixed, text); + } + + /** + * Convenience function to add a text field to this container/window. + * + * @param x column relative to parent + * @param y row relative to parent + * @param width visible text width + * @param fixed if true, the text cannot exceed the display width + * @param text initial text, default is empty string + * @param enterAction function to call when enter key is pressed + * @param updateAction function to call when the text is updated + * @return the new text field + */ + public final TField addField(final int x, final int y, + final int width, final boolean fixed, final String text, + final TAction enterAction, final TAction updateAction) { + + return new TField(this, x, y, width, fixed, text, enterAction, + updateAction); + } + }