This section teaches you to create a container using one of the GUI templates available in the IDE.
![]() |
Before you create the container, resize both the IDE and the online help windows so that the windows do not overlap. Grab any of the corners of each window with the mouse to resize it. Resizing the windows allows you to read the tutorial and follow the steps in the IDE at the same time. |
The top-level container that you create holds the other components (button and label) in your application. You create the container using the JFrame component and place the container in the colorswitch package. (A package is a group of related Java classes and interfaces.)
To create the container:
The New wizard opens.
The IDETutorial directory is mounted in the Explorer.
The New wizard for JFrame Form is displayed.
![]() |
If the active tab in the Explorer switched to the Runtime tab after you created the ColorSwitch form, click on the Filesystems tab before continuing with the rest of this tutorial. |
A node for the ColorSwitch Form object is added to the IDETutorial directory in the Explorer. The ColorSwitch node expands to display the nodes for the ColorSwitch class and the Form ColorSwitch.
In addition, the IDE automatically changes to GUI editing workspace, and the Form Editor and Source Editor are displayed.
The Form Editor contains three panes: the Component Palette, the Form Designer, and the Component Inspector. Starting in the upper left corner is the Component Palette. It contains numerous tabs for various AWT, JFC/Swing, and JavaBeans components, along with a selection of layout managers and border styles. Each tab has a corresponding toolbar which is displayed when the tab is selected. On the bottom left corner is the Form Designer. It is the layout area in which you create the ColorSwitch GUI. The right side of the Form Editor window is the Component Inspector. It provides a tree hierarchy representation of the components in your application and enables you to edit their properties using the property sheet in the lower panel.
The Source Editor shows the Java source code for the ColorSwitch class. You can type only in the white areas of the Source Editor.
Next: Selecting a Layout Manager
Back: Creating the ColorSwitch Application |
See Also | |
---|---|
Templates
Designing Java GUIs |