Tutorial Step 5 Step 7

Step 6: Nested Layouts

Now let's work on the center panel, Panel 3, which will contain a labeled command line and a text editing area.

First we'll add the Label and the TextField for the URL/command line that looks like this:

  1. At the top of Panel 3, add one shallow panel (Panel 12) across the top to contain the Label and TextField, then change this new panel to XYLayout.
  2. Using an AWT Label, draw a small Label component inside Panel 12 at the left. This component is not visible until you add some text to it. If you accidently click away from it, you can select it again by clicking on it in the Component Tree.
  3. With the Label component selected, double-click on its text property in the Inspector and type URL.
  4. While you're still in the Inspector, change the alignment property for the Label from 0 (left justified) to 1 (centered).
  5. To the right of the Label in Panel 12, draw an AWT TextField component to extend across the rest of the panel.
  6. Now fill the rest of Panel 3 with an AWT TextArea component under Panel 12 as shown below. Notice that the TextArea component includes scroll bars.

Save your work again.

Tutorial Step 5 Step 7