java me lwuit : string does not fit on screen
i am using sun's lwuit library for making my user interface in java me.
i have a string containing newline 开发者_如何学Pythoncharacters. 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.
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.
精彩评论