如何配置Netbeans格式化类字段声明(甚至局部变量)以排队?

时间:2012-03-15 21:13:22

标签: java netbeans formatting settings netbeans-7

我在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";

当我按格式(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 个答案:

答案 0 :(得分:0)

您可以将Jindent plugin用于Netbeans。但有一点需要注意:它是一个有限的评估版本。你必须支付完整版本。