Creating a Container

You begin by opening the New wizard from the menu bar in the main window. The top-level container that you create will hold the other components (button and label) in your application. You will create the container using the JFrame component and place it in the colorswitch package. (A package is a group of related Java classes and interfaces.)

To create the container:

  1. Choose File and chooose New.

    The New wizard is displayed.

  2. In the Select a Template pane of the Choose Template panel, expand the GUI Forms node, and then select JFrame.

    A description of the JFrame component appears in the Template Description pane.

  3. Click Next to go to the Target Location panel of the wizard.
  4. Type ColorSwitch in the Name text field.
  5. Click in the Package field and type colorswitch.
  6. Click Finish in the wizard.

    A ColorSwitch object is added to the current directory displayed in the Filesystems pane of the Explorer window. Expand the node to see the nodes for the ColorSwitch class object and the top-level GUI container, ColorSwitch JFrame.

    In addition, the workspace automatically changes to GUI Editing and the Form Editor and Source Editor are displayed. The Form Editor contains three panes: the Form Designer, the Component Inspector, and the Component Palette. The Form Designer is the layout area in which you will create the ColorSwitch GUI. The Component Inspector provides a visual representation of the components in your application and enables you to edit their properties. The Component Palette is located above the Form Designer pane. It contains numerous tabs for various AWT, Swing, and JavaBeans components, along with a selection of layout managers and border styles. The Source Editor shows the Java source code for the JFrame component. You can type only in the white areas of the Source Editor.

Next:  Choosing a Layout Manager
Back:  Creating the ColorSwitch Application

Legal Notices