NetBeans 有没有办法在单独的行中自动创建括号?

发布于 2024-08-18 05:43:16 字数 516 浏览 2 评论 0原文

例如,当我创建一个新类时,我得到这样的信息:

/*
 * 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 
{

}

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 
{

}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

你又不是我 2024-08-25 05:43:16

只需按照以下步骤操作:

  1. 导航至 Tools ->选项->编辑器
  2. 导航至编辑器 ->格式
  3. 选择以下内容
    • 语言:Java
    • 类别:牙套
  4. “类声明、方法声明等”中的 大括号
    • 牙套放置:换行

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
恍梦境° 2024-08-25 05:43:16

还有 JIndent 插件。

Also there's the JIndent plugin.

压抑⊿情绪 2024-08-25 05:43:16

在 Netbeans 中,转到工具 > 选项。然后选择格式化选项卡,并在语言下拉列表中选择Java

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

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文