Designing Pages

The primary design activity involves adding containers and components and arranging them with layouts to create the application's visual appearance. The best way to do this is to use different layouts applied to nested containers to control the positioning and sizing of components.

The following procedure demonstrates the basic steps for defining a UI. This example uses the Nexaweb Java schema.

Using the Palette and Properties views, drag and drop components into the java-index.xal UI file, and modify them to create a Login dialog as described in the following steps.

1. Drag a Dialog component from the Containers drawer of the Palette view onto the java-index.xal file.

2. Add a gridPane with two columns to the dialog as follows:

3. Add a label to the dialog as follows:

4. Drag a textField component from the Components drawer onto the dialog.
Studio aligns the
textField in a gridLayout beside the label.

5. Drag a label component from the Components drawer onto the dialog.
Studio aligns the
label in the first column beneath the first label that you added.

6. Drag a passwordField component from the Components drawer onto the dialog.
Studio aligns the
passwordField in the second column beneath the textField and beside the second label that you added to the dialog.

7. To change the height and width of the dialog, either:

Visual Editor

Properties view

  • Click on the dialog component to select it and resize handles appear around the component

  • Place your cursor over one of the resize handles and then drag the edge of the dialog to the size you want it.

    Or, to resize
    the component proportionally, place your cursor over one of the corners of the component until a double arrow appears, then drag the corner to the size that you want the component.

  • Click on the dialog component to select it.
    The
    Properties view displays the dialog's properties

  • Scroll through the Properties view to the Size & Location section.

  • Specify the height or width in pixels (px)

 

8. To add a title to the dialog:

 The login dialog that you created appears similar to the following:

image\img00010.gif

Figure 8: Login Dialog

The source for this dialog appears similar to the following:

<xal xmlns="http://openxal.org/ui/java">

<rootPane>

<freePane width="1024px" height="768px">

<dialog height="120px" title="Login" width="340px" x="30px" y="70px">

<gridPane columns="2" height="300px" width="300px">

<label height="20px" text="Name:" width="100px"/>

<textField height="25px" text="TextField" width="200px"/>

<label height="20px" text="Password:" width="100px"/>

<passwordField height="25px" text="Password Field" width="200px"/>

</gridPane>

</dialog>

</freePane>

</rootPane>

</xal>