java me lwuit:字符串不适合屏幕

发布于 08-19 16:55 字数 322 浏览 4 评论 0原文

我正在使用 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

箹锭⒈辈孓2024-08-26 16:55:58

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文