Percent layout places components vertically or horizontally and sizes its according to its percentage constraints.
// create panel and set percent layout for it var p = new zebkit.ui.Panel(); p.setLayout(new zebkit.layout.PercentLayout()); // add three buttons to the panel that are laid out horizontally with // percent layout according to its constraints: 20, 30 and 50 percents p.add(20, new zebkit.ui.Button("20%")); p.add(30, new zebkit.ui.Button("30%")); p.add(50, new zebkit.ui.Button("50%"));
[dir], [gap], [stretch])
Direction the components have to be placed (vertically or horizontally)
Pixel gap between components
Boolean flag that say if the laid out components have to be stretched vertically (if direction is set to "vertical") or horizontally (if direction is set to "horizontal")