I want to place a Button in the center of a row of a Container , the Button is the only component of the Container. How to achieve that ?
Asked
Active
Viewed 160 times
0
-
code please... we cant read minds.. maybe use `style="margin:auto;"` – Piotr Kula Jul 06 '11 at 09:16
-
Container c = new Container(); Button b = new Button(); c.addComponent(b); – Jul 06 '11 at 09:24
-
@Andy: Are you using multiple button's? – bharath Jul 06 '11 at 10:44
-
@bhakki: just one LWUIT Button – Jul 06 '11 at 10:56
2 Answers
0
Container c = new Container(new FlowLayout(Component.CENTER));
Button b = new Button();
c.addComponent(b);

Shai Almog
- 51,749
- 5
- 35
- 65
0
Just set the BorderLayout
to Container
. Then add the Button
into Container
and set the constraints to CENTER
.
For example,
Container c = new Container(new BorderLayout());
Button btn = new Button("Sample");
c.addComponent(BorderLayout.CENTER, btn);

bharath
- 14,283
- 16
- 57
- 95