开发者

button lWUIT j2me setlocation

开发者 https://www.devze.com 2023-03-18 23:49 出处:网络
How can i set the Button location in LWUIT?? 开发者_如何学编程public void error() { error = new Dialog();

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

精彩评论

暂无评论...
验证码 换一张
取 消