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();
}
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:
Container c = new Container(new FlowLayout(Component.CENTER));
c.addComponent(btn);
精彩评论