按钮 lWUIT j2me setlocation
如何在 LWUIT 中设置按钮位置?
public void error()
{
error = new Dialog();
e = new Label("EMPTY FIELDS!!!");
t= new TextArea("You Can't Leave The Fields Empty...",8,13);
error.addComponent(e);
error.addComponent(t);
eok = new Button("Ok");
eok.setAlignment(Component.CENTER);
eok.addActionListener(this);
error.addComponent(eok);
error.show();
}
How can i set the Button location in LWUIT??
public void error()
{
error = new Dialog();
e = new Label("EMPTY FIELDS!!!");
t= new TextArea("You Can't Leave The Fields Empty...",8,13);
error.addComponent(e);
error.addComponent(t);
eok = new Button("Ok");
eok.setAlignment(Component.CENTER);
eok.addActionListener(this);
error.addComponent(eok);
error.show();
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您需要使用布局管理器。我猜您正在尝试将按钮居中,而不仅仅是将其与中心对齐,只需将其添加到具有中心流布局的容器中即可:
You need to use a layout manager. I'm guessing you are trying to center a button and not just align it to the center, just add it to a container with a center flow layout: