java如何配置Netbeans来格式化类字段声明(甚至是局部变量)以对齐?
我在Netbeans(7)中找不到对齐变量的选项。例如,我想更改以下内容:
private int hello = 1;
private static int hello2 = 1;
public static String hello3 = "yo";
private final static int HELLO3 = 1;
private String stringy = "testing hello";
private char c = 'a';
这(或类似的事情):
private int hello = 1;
private static int hello2 = 1;
private final static int HELLO3 = 1;
private char c = 'a';
private String stringy = "testing hello";
public static String hello3 = "yo";
当我按Format(alt+shift+f
)时
此外,我希望它适用于局部变量,因此:
private void Test()
{
int x = 2;
String z = "test";
int[] y = {1, 2, 3};
}
将变成这样:
private void Test()
{
int x = 2;
int[] y = {1, 2, 3};
String z = "test";
}
我查看了Tools->Options->Editor->Language "Java"->Category "Alignment"
,但是,我没有发现任何影响这一点的因素
# 1 楼答案
您可以将Jindent plugin用于Netbeans。但有一个警告:这是一个有限的评估版本。你必须为完整版本付费