Code Formatter

The preview pane on this page demonstrates what each of these options will do to Java code in the editor.

Code Formatter Preferences

Option

Description

Default

Insert new line before opening brace

The editor inserts a line break before opening a new brace. In other words, open braces always start at the beginning of a new line.

Off

Insert new line in control statement

The editor inserts a line break before a new control statement. In other words, control statements (e.g., if, else, catch, finally, etc.) always start at the beginning of a new line.

Off

Clear all blank lines

The editor deletes all blank lines in the file.

Off

Keep else if on the same line

The editor always keeps the words "else" and "if" in else-if statements together on the same line of code.

Off

Insert a new line inside an empty block

The editor inserts a line break between empty braces. In other words, the left and right braces in an empty braces set will always appear on separate lines. An exception is if the right brace is followed by a keyword, in which case, the two braces appear on the same line.

On

Compact assignment

The editor removes any spaces between a variable and an assignment statement so that they are asymmetrical (e.g., a= b; ).

Off

Indentation is represented by Tab

The editor uses tabs instead of spaces to represent indentations.

On

Amount of spaces representing a tabulation

If the editor uses spaces instead of tabs to represent indentations, this is the number of spaces that comprises a single indentation.

4.

Maximum line length

This is the maximum length of any one line. Lines longer than this number are split and wrapped. Entering 0 here disables line splitting completely.

8.

Preview pane

Shows an example of what your Java code will look like with the settings currently displayed on this page.

n/a