Separators

Separators are simple components that are similar to a horizontal rule in HTML. They have an optional heading and are generally used to partition content, as shown in the sample application below:

The WTKX for this sample is as follows. Note that the box pane sets the "fill" style to true; otherwise, the separator would not grow to fill the horizontal space:

<Window title="Separators" maximized="true"
    xmlns:wtkx="http://pivot.apache.org/wtkx"
    xmlns="org.apache.pivot.wtk">
    <content>
        <BoxPane orientation="vertical" styles="{padding:4, spacing:10, fill:true}">
            <Separator heading="Section 1"/>
            <Label text="This is the content of section 1."/>
            <Separator heading="Section 2"/>
            <Label text="This is the content of section 2."/>
            <Separator heading="Section 3"/>
            <Label text="This is the content of section 3."/>
        </BoxPane>
    </content>
</Window>

The Java code simply serves to load the WTKX:

package org.apache.pivot.tutorials.separators;

import org.apache.pivot.collections.Map;
import org.apache.pivot.wtk.Application;
import org.apache.pivot.wtk.DesktopApplicationContext;
import org.apache.pivot.wtk.Display;
import org.apache.pivot.wtk.Window;
import org.apache.pivot.wtkx.WTKXSerializer;

public class Separators implements Application {
    private Window window = null;

    public void startup(Display display, Map<String, String> properties)
        throws Exception {
        WTKXSerializer wtkxSerializer = new WTKXSerializer();
        window = (Window)wtkxSerializer.readObject(this, "separators.wtkx");
        window.open(display);
    }

    public boolean shutdown(boolean optional) {
        if (window != null) {
            window.close();
        }

        return false;
    }

    public void suspend() {
    }

    public void resume() {
    }

    public static void main(String[] args) {
        DesktopApplicationContext.main(Separators.class, args);
    }
}

Next: Layout Containers