如何在 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();
}
最佳答案
您需要使用布局管理器。我猜您正在尝试将按钮居中,而不仅仅是将其与中心对齐,只需将其添加到具有中心流布局的容器中即可:
Container c = new Container(new FlowLayout(Component.CENTER));
c.addComponent(btn);
关于java - 按钮 lWUIT j2me setlocation,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6620355/