Posts Tagged ‘Code Formatting’

Code Formatting in Netbeans 6.8

April 17th, 2010

In any project in web world, code formatting plays a key role during the development of the project as it makes the code review process very simple at least from readability point of view.

The more readable your code is the more easy it is to review it. Now, how to format the code in Netbeans 6.8.

There are two levels at which formatting can be performed in Netbeans 6.8.

1) At a global level – It’s applicable across all the projects for which netbeans would be used

2) At a project level – It is specific to a particular project

For the first option

a) Go to Tools->Options->Editor-> Formatting

b) Please select the language for which you want to apply the formatting, for me it is PHP

c) Select the category, which could be Tabs and Indent or Braces

d) Put your option for Tabs and Indent in terms of tabs or if you choose to go with spaces

e) For braces, you can select new line, same line or preserve existing

This is pretty useful as if you are aware of it, it saves lot of effort from your end.

Enjoy working with Netbeans 6.8 !!