corner imagecorner image FeaturesPluginsDocs & SupportCommunityPartners


 

Form editor
  Source editor   Object Browser   Javadoc   Compiler   Debugging   JDK support

The Form Editor
Designing a GUI with the IDE is quick because students don't need to worry about generating and updating code while trying out different layout managers, parameters, and components. Just click and drop the components onto the form. The IDE comes with the standard swing and awt components.  When you choose New from Template and choose a class from the SwingForms category, the Form Editor (which includes the Form window, Component Inspector, and Editor) comes up.

In the Component Inspector you can examine and adjust properties of your components, define how code is generated, and set properties such as the layout manager you want to use.

Using the Form Editor
To add components to your form, select them on the Component Palette (on the main window at the top of the screen) by clicking your choice of component; then click your form in the area where you'd like that component to be placed.

How components are placed on a form depends on the Swing layout manager you choose to use. You can set that in the Component Inspector:

Guarded Blocks - interaction with the code editor
What you do in the Form Editor is stored in an XML file with the extension .form with the same name as your class. This XML is used to generate the code that instantiates and initializes your visual components. This code appears in a method called InitComponents(), which appears in a guarded block in the editor (blue background).

 Guarded blocks cannot be edited using the code editor. However, this does not stop you from doing anything you want to do with your components, or instantiating them as you wish. The way objects are instantiated and initialized can be completely controlled using the meta-properties on the Code Generation tab of the Component Inspector. If you want, you can completely replace the instantiation code for a component with as many lines of your own code as you want.

Tip: It is not a good idea to edit GUI classes generated using the Form Editor in an external editor, and then reload them in the IDE. Since the code in the guarded blocks is generated from the XML form file, any changes made outside the IDE will be overwritten the first time it is loaded back into NetBeans.

Note: You do not need to distribute the .form files with your application or classes - the IDE generates 100% clean, pure Java code. You should, however, keep the .form file with your sources if you want to edit your class using the Form Editor in the future. 
 

Form editor
  Source editor   Object Browser   Javadoc   JSP support   Debugging   JDK support

 
 
loading
Please Confirm