Class zebkit.layout.PercentLayout
mixed with <zebkit.layout.Layout>

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%"));
zebkit.layout.PercentLayout ([dir], [gap], [stretch])

  • [dir] <String>

    a direction of placing components. The value can be "horizontal" or "vertical"

  • [gap] <Integer>

    a space in pixels between laid out components

  • [stretch] <Boolean>

    true if the component should be stretched vertically or horizontally

Inherited methods:

public <String> direction

Direction the components have to be placed (vertically or horizontally)

public <Integer> gap

Pixel gap between components

public <Boolean> stretch

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")