View Full Version : How to get FlowLayout to horizontally?

17 Aug 2009, 7:08 AM
How can I layout the component horiztonatally and let it flow to next line vertically?
In the code below, the button2 keeps going below button1.

LayoutContainer layoutCon = new LayoutContainer();
layoutCon.setLayout(new FlowLayout());

Button button1 = new Button();
button1.setSize("32px", "32px");
layoutCon.add(button1,new FlowData(5));

Button button2 = new Button();
button2.setSize("32px", "32px");
layoutCon.add(button2,new FlowData(5));

17 Aug 2009, 7:10 AM
FlowLayout uses the browser flow. The browserflow just renders each item undet the other.

Jan Nawara
17 Aug 2009, 11:34 AM
Try adding this to each button.

button.setStyleAttribute("float", "left");

You will also most likely need to add padding or margins to your layout or buttons also.

17 Aug 2009, 6:49 PM
Thanks a lot Jan.