UpPreviousNext

Java Layouts

A number of layouts are available in AWT for arranging components in your application. Builder Xcessory allows you to work with these layouts intuitively.

Programming Java layouts manually

When programming Java manually, use the following procedure to lay out and manage the objects in your interface:

1. Create the parent object (the container).

2. Create the children (the objects to be managed).

3. Create a layout object.

4. Pass the layout object to the parent.

5. Pass the children to the parent.

Programming Java layouts when using GridBagLayout

However, when using the powerful and flexible GridBagLayout, programming manually becomes time-consuming, as follows:

1. Create the parent object (the container).

2. Create the children (the objects to be managed).

3. Create the GridBagLayout (GBL) object.

4. Pass the GBL to the parent.

5. Create a GridBagConstraints (GBC) object.

6. Set the GBC values for a particular child.

7. Pass the GBC and the child to the GridBagLayout object.

8. Pass the child to the parent.

9. Repeat steps 5-8 for each child to be managed.

Programming Java layouts with Builder Xcessory

With Builder Xcessory, this is considerably simpler. With any layout, including the GridBagLayout, use the following procedure:

1. Create the parent object (the container) and the children (the objects to be managed).

2. Use the Resource Editor to set the desired layout (on the parent).

3. Use the Resource Editor to set the desired constraints (on each of the children).

Builder Xcessory automatically synthesizes all of this information to create the appropriate layout objects for you. You can change the layout, add children of any type at any time, or nest layouts. All changes are reflected immediately and automatically in your interface so you can see the results of your changes as you make them.

UpPreviousNext