LWUIT:如何将标签分配给文本字段
我想为 TextField
分配一个标签。我使用以下代码,
TextField textField = new TextField();
Label label = new Label("Pick a unique username");
textField.setLabelForComponent(label);
textField.setConstraint(TextField.ANY);
form.addComponent(textField);
form.show();
上面的代码未显示 TextField
的关联标签。怎么办呢?
i want to assign a label to the TextField
. I am using the following code
TextField textField = new TextField();
Label label = new Label("Pick a unique username");
textField.setLabelForComponent(label);
textField.setConstraint(TextField.ANY);
form.addComponent(textField);
form.show();
the above code is not showing the associated label for the TextField
. How can it be done ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
LWUIT javadoc @ 中
Component
的摘录link因此,您只需将
Label
与此Component
相关联,现在将它们实际绑定在一起作为感知/视觉上的单个组。。
我建议您使用
ComponentGroup
并添加TextField
和Label
,您也可以将它们设置为一个组。检查此链接有关ComponentGroup
的更多信息PS:
ComponentGroup
可从 LWUIT 1.5 获取。An excerpt of the
Component
from the LWUIT javadoc @ linkHence your are just associating a
Label
with thisComponent
and now actual binding them together as perceived / visually single group..
I would recommend you use
ComponentGroup
withTextField
andLabel
added to it, also you can style them as a group. Check this link for more information onComponentGroup
PS:
ComponentGroup
is available from LWUIT 1.5.