Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top