views:

185

answers:

1

i am using sun's lwuit library for making my user interface in java me.

i have a string containing newline characters. this is what i do:

String str = "lfjsdfsdfdkf\nsfljl\nsdfj";
TextArea box = new TextArea(str);
box.setEditable(false);
tab.addComponent(box);

tab is of type com.sun.lwuit.Container. Now when the string is displayed on the screen, all of it comes in one line. the new line character does not show up.

how to fit the string within the screen.

A: 

In the TextArea constructor you specified, the documentation says it places all in a single line. You have to specify the number of lines by using another constructor of the TextArea class.

Valentin Rocher