Lesson: Using the NetBeans GUI Builder
This lesson explains how to use the NetBeans IDE GUI Builder to work with
beans. In preparation for working with the GUI Builder, you should be first familiar with
the key NetBeans concepts which are explained in the
Using NetBeans IDE Guide
.
This lesson guides you through the process of creating a bean pattern in the
NetBeans projects, introduces the user interface of the GUI Builder, and explains
how to add your bean object to the palette.
Creating a New Project
In the NetBeans IDE, you always work in a project where you store sources
and files. To create a new project, perform the following steps:
- Select New Project from the File menu. You can also click the New
Project button in the IDE toolbar.
- In the Categories pane, select the General node. In the Projects pane,
choose the Java Application type. Click the Next button.
- Enter MyBean in the Project Name field and specify the project
location. Do not create a
Main class here, because later you will
create a new Java class in this project.
- Click the Finish button.
This figure represents the expanded MyBean node in the Projects list.

Creating a New Form
After creating a new project, the next step is to create a form within which
the JavaBeans components and other required GUI components, will be
placed.
To create a new form, perform the following sequence of actions:
- In the Projects list, expand the MyBean node, right-click on the <default package> node
and choose New|JFrame Form from the pop-up menu.
- Enter MyForm as the Class Name.
- Click the Finish button.
The IDE creates the MyForm form and the MyForm class within
the MyBean application and opens the MyForm form in
the GUI Builder.
This figure represents the Projects list, where the MyForm class is located.
The GUI Builder Interface
When the JFrame form is added to your application, the IDE opens the
newly-created form in an Editor tab with a toolbar containing the following
buttons::
-
– Selection Mode enables you to select one or
more objects in the Design Area.
-
– Connection Mode enables you to set a
connection between objects by specifying an event.
-
– Preview Design enables you to preview the form layout.
-



– Align commands enable you to align selected objects.