NetBeans是否有一种方法可以在单独的行中自动创建括号?

问题描述:

当我创建例如一个新的类,我得到这个:NetBeans是否有一种方法可以在单独的行中自动创建括号?

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

package helloworld; 

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

它,当支架放置这种方式。有没有一种方法,使之创造这样的事情:

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

package helloworld; 

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

} 
+1

细节总是在里面。 – 2010-01-16 05:13:12

+0

你在说什么? :S – 2010-01-16 05:13:41

+0

hehe有趣的是,我在Java中使用了这种风格(用新的方式使用大括号)。我讨厌使用前者的同样方式(在同一行中使用大括号)我认为每种语言都应该遵循核心使用的约定。 – OscarRyz 2010-01-16 06:27:10

只需按照下列步骤操作:

  1. 导航到Tools -> Options -> Editor
  2. 导航到Editor -> Formatting
  3. 选择以下
    • 语言:Java
    • 类别:支撑s
  4. 在“类声明,方法声明等”
    • 牙套放置:新线
+0

令人难以置信的简单。 Netbeans令人印象深刻。 – 2010-01-16 13:24:29

+0

不幸的是,目前在Netbeans 6.8中(至少C/C++和PHP)已经损坏了:( – 2010-01-16 23:45:47

+0

它在NetBeans 8.2中为PHP工作正常 – 2018-02-13 01:49:43

在NetBeans去工具>选项。然后选择格式选项卡并选择Java下的语言下拉列表。

现在有几个选项可以按照您喜欢的方式更改格式。

还有JIndent插件。