Formatting code
The Editor provides several features that make it easier for you to create well-formatted and easy-to-read code.
When you type a line of code in the Editor and press ENTER, the next line is automatically indented according to its hierarchy in the code. However, you can easily modify the indents with keyboard shortcuts:
In both cases, if nothing is selected, the whole line is shifted one tab stop. If a block of text is selected, those lines are all shifted.
If you have made changes to the formatting of a file and would like to go back to the default formatting, use the Alt+f keyboard shortcut or right-click in the Editor window and choose Reformat Code. If no text is selected when you choose this command, the whole file will be formatted. Otherwise, the selected lines are reformatted.
There are several configurable options for formatting of automatically generated code. See Java Editor formatting options.
Contents | Prev | Next | Index |