java me lwuit:字符串不适合屏幕
我正在使用 sun 的 lwuit 库在 java me 中制作我的用户界面。
我有一个包含换行符的字符串。这就是我所做的:
String str = "lfjsdfsdfdkf\nsfljl\nsdfj";
TextArea box = new TextArea(str);
box.setEditable(false);
tab.addComponent(box);
选项卡的类型为 com.sun.lwuit.Container。现在,当该字符串显示在屏幕上时,所有字符串都在一行中。新行字符不显示。
如何使字符串适合屏幕。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

在 TextArea您指定的构造函数,文档说它将所有内容放在一行中。您必须使用 TextArea 类。
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.