20

When I create a new class for instance, I get this:

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package helloworld;

/**
 *
 * @author Sergio
 */
public class WordManipulations{        
}

I hate it when brackets are placed this way. Is there a way to make it create things like this:

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package helloworld;

/**
 *
 * @author Sergio
 */
public class WordManipulations 
{

}
Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
Sergio Tapia
  • 40,006
  • 76
  • 183
  • 254
  • What are you talking about? :S – Sergio Tapia Jan 16 '10 at 05:13
  • hehe The funny thing is that I have that style ( braces in a new line ) used in Java. The same way I hate C# using the former ( opening brace in the same line ) I think every language should adhere to the convention used by the core. – OscarRyz Jan 16 '10 at 06:27

3 Answers3

43

Simply follow these steps:

  1. Navigate to Tools -> Options -> Editor
  2. Navigate to Editor -> Formatting
  3. Select the following
    • Language: Java
    • Category: Braces
  4. In "Class Declaration, Method Declaration, etc."
    • Braces Placement: New Line
Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
Prasoon Saurav
  • 91,295
  • 49
  • 239
  • 345
2

Also there's the JIndent plugin.

Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
1

In Netbeans go to Tools > Options. Then select the Formatting tab and select Java under the language drop down.

There are now several options to change the formatting the way you like it.

Vincent Ramdhanie
  • 102,349
  • 23
  • 137
  • 192