Creating New Code

As you work with the IDE to create and change user interfaces, properties, and so on, Java source files are automatically generated and updated in the Source Editor. All automatically generated code appears in blue shaded areas of guarded text that you cannot edit directly, although you can affect the way it is generated.

You can type in your own code at any time in the non-guarded areas of the Source Editor. The Source Editor has many shortcuts to make this easier, including automatic formatting and automatic text completion with the code completion and word match features.

In addition to these shortcuts, (which you can read about in the links below), the Source Editor provides shortcuts for adding new Java elements with a minimum of typing.

To generate the basic structure for a new class or interface:

  1. Move the insertion point to an area outside of any existing class or interface.

  2. Right-click and choose New Class or New Interface from the the contextual menu. A customizer dialog appears that enables you to specify elements of the new class or interface declaration.

  3. Fill in the customizer dialog and click OK. The structure for your new class or interface appears in the Source Editor after any existing classes or interfaces.

To generate text for a new initializer, field, constructor, method, inner class, or inner interface:

  1. Move the insertion point to an area within a class or interface.

  2. Right-click and choose the desired object from the New submenu of the contextual menu. Unless you choose Initializer, a customizer dialog appears allowing you to specify the appropriate elements of the new Java object.

  3. Fill in the customizer dialog and click OK. The new text may appear in the Source Editor after other existing Java objects.
When you generate Java text with the New option on the contextual menu, you may need to scroll to find your new text. It is normally added in an appropriate place after existing Java objects.
See also
Using Java and HTML Completion

Using the Word Match Feature

Working With Source Code

Guarded Text

Legal Notices