Using Tabulator for Indentation
By Petr on May 24, 2011
Yesterday I run into an issue that a user wants to use tabulator character for indentation level. Because I answer similar question often, I will try to explain it here.
By default NetBeans editors use for indentation level 4 spaces and don't use tabulator character (\t). When you press Tab key, then NetBeans place caret on the column that corresponds to the next indentation level and the difference is filled with spaces. So by default pressing Tab key adds 4 spaces.
If you want to use tabulator, you have to change the default behavior in Tools->Options->Editor->Formatting Tab. See the picture below, where are the default values.
Notice that by default the property Tab Size is setup to 8. This is because the standard size of tabulator is 8 characters wide. So when you want to use tabulator for every indent level you have to uncheck Expands Tabs to Spaces check box and you have to decrease the Tab Size property to 4 or increase Number of Spaces per Indent to 8. In other words the Tabs Size and Number of Spaces per Indent has to be the same.
I have to agree that from this point of view, the default values doesn't seem to be logical, but the terminals and many printers treat tabulator as 8 characters wide.