Skip to main content

Appending text into TextArea

3 replies [Last post]
kahrena
Offline
Joined: 2007-04-15

Hi, I have not been able to find the equivalent of form.append(String) in LWUIT. Can you help? I need to parse packets of data then update the TextArea in a loop.
Thanks!
K

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
asterfr
Offline
Joined: 2008-07-17

Have you tried ton get the text and to set it with your string append after ?

kahrena
Offline
Joined: 2007-04-15

well, there is no append for textArea in LWUIT....at least I could not find it.btw, I am trying to avoid collecting all the info and zapping the textarea once.any ideas would be appreciated.

kawaiimomo
Offline
Joined: 2008-07-10

I think astefr referred to something like:

TextArea txt = new TextArea("starting text");

String existingText = txt.getText();

txt.setText(existingText + " new text to append");

You could also do it in a single line: txt.setText(txt.getText() + " new Text");

If you are appending to much String, maybe you should use StringBuffer and append() instead of concatenating Strings.

Regards

Oops, I didn't see you want to do this without asking the TextArea about its text content...

Message was edited by: kawaiimomo