Step 2: Add a TextArea to fill the center of the UI
We want to have a TextArea completely fill the center of the UI. To do this, we'll change the layout for bevelPanel1 to BorderLayout before we add the TextArea component.
- Select bevelPanel1 in the Component Tree.
- Change its layout property in the Inspector to BorderLayout, then press Enter.
- Click the AWT tab of the Component Palette, which is located above the AppBrowser on the right side of the JBuilder Main window.
- Select the TextArea component.
- Click in the middle of bevelPanel1 in the UI Designer to drop the TextArea into the Center area of the panel.
- Make sure that in the Inspector, the constraints property for textArea1 is set to Center.
When BorderLayout has only one component, and that component is constrained to Center, BorderLayout will completely fill up the container with that component. If the constraints property is not set to Center, change it by selecting Center from the drop-down list and press Enter to commit the change to code.
Note: If the design area is too narrow in the AppBrowser to see all the UI at once, you can drag the right edge of the AppBrowser until all of it is exposed.
Now, compile your program and run it to see how it looks.
- Choose Build|Make Project "TextEdit.jpr" from the menu.
This compiles all the files in the project and creates a TextEdit.class file in the JBuilder "myclasses" directory. It should compile without any errors.
- Click the Run button
on the JBuilder toolbar, or choose Run|Run from the menu.
Your UI should look like this, now, at runtime:
Click the TextEdit window's system close button [X] to close the runtime window.
Next we will create the menus for the AppBrowser.