RNZN
RNZN

Reputation: 107

button lWUIT j2me setlocation

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();
  }

Upvotes: 0

Views: 736

Answers (1)

Shai Almog
Shai Almog

Reputation: 52760

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);

Upvotes: 1

Related Questions