Project Properties: Formatting
In this panel, define the formatting style you want to apply to
your source files in the editor. The settings in this panel apply
only to this project. However, the panel links to the global formatting
options dialog.
- Use Global Options or Use Project-Specific Options. Select whether to use the global
NetBeans formatting options or project-specific options. You define project-specific options in this
dialog.
- Edit global options. Button enabled when you select to Use global options. Click to open
the global Editor Options for the IDE. Select the Formatting tab in the Editor Options. The UI for
the Formatting tab is the same as the UI for the Formatting project properties.
- Load from other project. Button enabled when you select to Use project-specific
options. Click to load project-specific options from another project. The Open Project dialog opens.
- Preview: The Preview window contains sample code that reflects changes you make in Formatting.
- Language: Select either All Languages or the project's language (Java or PHP).
All Languages
All Languages refer to all languages except C++.
If you select All Languages, the only Category of options is Tabs and Indents.
- Expand Tabs to Spaces. When selected, inserts spaces when the Tab key is typed.
When unselected, typing the Tab key inserts the tab character (\t) into the file if
possible. It also replaces preceding spaces with the tab character if possible.
The Source Editor calculates where to place tab characters based on the value
of the Tab Size property.
If Expand Tabs to Spaces is unselected and the Number of Spaces per Indent is different
than the Tab Size property, the indentation created by typing the Tab key is
made up of a combination of spaces and tab characters. It is easiest to predict
the location of tab characters if you set Number of Spaces per Indent to an even
multiple or divisor of Tab Size.
- Important: This feature does not convert
existing tabs to spaces. Only tabs that you add after you
enable this option are converted.
- Indent: Number of spaces per indentation level for subelements, new lines inside
brackets, etc.
- Tab size:See the description of Expand Tabs to Spaces, above.
- Right margin: Position of the vertical red line that indicates the right margin.
- Line wrap: Whether lines are wrapped when they are longer than the width of the Editor window (no relationship to right margin). Options are:
- Off. No line wrapping (default).
- After words. Words are not broken by line wrapping.
- Anywhere. Lines are broken in the middle of words by line wrapping.
Java Language
For Java formatting options, see Java Formatting
PHP Language
For PHP formatting options, see PHP Formatting.
Legal Notices