Monday, July 12, 2010

LWUIT: BoxLayout

The BoxLayout class puts components either on top of each other or in a row.

LWUIT: BoxLayout.X_AXIS


BoxLayout boxLayout = new BoxLayout(BoxLayout.X_AXIS);
f.setLayout(boxLayout);
f.setTitle("BoxLayout: BoxLayout.X_AXIS");

Button button1 = new Button("Button 1");
Button button2 = new Button("Button 2");
Button button3 = new Button("Button 3");
f.addComponent(button1);
f.addComponent(button2);
f.addComponent(button3);


LWUIT: BoxLayout.Y_AXIS


BoxLayout boxLayout = new BoxLayout(BoxLayout.Y_AXIS);
f.setLayout(boxLayout);
f.setTitle("BoxLayout: BoxLayout.Y_AXIS");

Button button1 = new Button("Button 1");
Button button2 = new Button("Button 2");
Button button3 = new Button("Button 3");
f.addComponent(button1);
f.addComponent(button2);
f.addComponent(button3);