Creating and Editing Files


Once you have a project set up, you can add files to your project and start editing. You can add files to a project by creating them with the New File wizard.

To open the New File wizard, do one of the following:

  • In the Projects window, right-click the Source Packages node (or one of the package nodes underneath it) and choose one of the templates from the New submenu. If none of the templates there suits you, choose File/Folder (as shown in Figure 2-5) to open a wizard with a complete selection of available templates.

    Figure 2-5. Projects window, creating a new file

  • Choose File | New File to open the New File wizard.

In the New File wizard, you can name the file and specify a folder. For Java classes, you can designate a period-delimited package name (as opposed to a slash-delimited folder name).

Once you complete the wizard, the file opens in a tab in the area of the IDE to the right of the Projects window. For most templates, a Source Editor tab opens.

About the Source Editor

The Source Editor is the central area of the IDE where you write and generate code. The Source Editor is actually a collection of different types of editors with different purposes. There are text editors for different types of files, such as Java, JSP (as shown in Figure 2-6), XML, HTML, and plain-text files. These editors all share a base of features (such as a set of common keyboard shortcuts). The individual editors have features unique to that file type, such as syntax highlighting, additional keyboard shortcuts, code completion, special navigation shortcuts, and so on. See Chapter 5 for a survey of Source Editor features.

Figure 2-6. Source Editor window with a JSP file open


There are also visual editors for AWT and Swing forms, deployment descriptors, and other types of files, although it is possible to edit the source of these types of files directly.

For example, GUI templates such as JPanel Form and JFrame Form open in a visual design area (as shown in Figure 2-7) along with Palette, Inspector, and Properties windows. You can click the Source button in the design area's toolbar to access the file's source.


Figure 2-7. Form Editor Design view in the Source Editor window




NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net