X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fjexer%2FTField.java;h=9a3d16b5832e12514973c2a1bed795d9ef86ebff;hb=847a4bc53c549c277d479ee904ab45be7f5e4dec;hp=07a457bcf7eb7beb4e05af9e71f8f782a6cc2227;hpb=7c870d89433346ccb5505f8f9ba62d3fc18fe996;p=fanfix.git diff --git a/src/jexer/TField.java b/src/jexer/TField.java index 07a457b..9a3d16b 100644 --- a/src/jexer/TField.java +++ b/src/jexer/TField.java @@ -55,6 +55,17 @@ public class TField extends TWidget { return text; } + /** + * Set field text. + * + * @param text the new field text + */ + public final void setText(String text) { + this.text = text; + position = 0; + windowStart = 0; + } + /** * If true, only allow enough characters that will fit in the width. If * false, allow the field to scroll to the right. @@ -201,7 +212,7 @@ public class TField extends TWidget { end = text.length(); } getScreen().hLineXY(0, 0, getWidth(), GraphicsChars.HATCH, fieldColor); - getScreen().putStrXY(0, 0, text.substring(windowStart, end), + getScreen().putStringXY(0, 0, text.substring(windowStart, end), fieldColor); // Fix the cursor, it will be rendered by TApplication.drawAll().