Is there a way for NetBeans to automatically create brackets in a separate line?

Sergio Tapia picture Sergio Tapia · Jan 16, 2010 · Viewed 7.4k times · Source

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 
{

}

Answer

Prasoon Saurav picture Prasoon Saurav · Jan 16, 2010

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