X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTWidget.java;h=25e43f71f7e651d503709214cd68d656467c0d8f;hb=128e5be1ffb65d047d8461ea1cfb65c22686ec91;hp=0f920ba976242b5d81240682dac7f8d18a1ff89e;hpb=00d2622b0fff2411dc81ee2a0cc43a5f3f52564c;p=fanfix.git diff --git a/src/jexer/TWidget.java b/src/jexer/TWidget.java index 0f920ba..25e43f7 100644 --- a/src/jexer/TWidget.java +++ b/src/jexer/TWidget.java @@ -1046,5 +1046,55 @@ public abstract class TWidget implements Comparable { 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); + } }