简体   繁体   English

如何让NetBeans自动将你移到花括号内?

[英]How to make NetBeans automatically move you inside curly braces?

I downloaded NetBeans as a replacement for Eclipse, and I like it so far, but there's one thing I can't figure out. 我下载了NetBeans作为Eclipse的替代品,到目前为止我喜欢它,但有一点我无法弄清楚。 In eclipse, when you are inside two curly braces and press enter, it will move you inside the body and add a tab. 在eclipse中,当你进入两个花括号并按下回车键时,它会将你移动到体内并添加一个标签。 It doesn't do it in NetBeans, and I would like to know if there's a setting/plugin that does that. 它在NetBeans中没有这样做,我想知道是否有设置/插件可以做到这一点。 Example (The pipe symbol "|" is the location of the cursor, AKA the thing that shows you where you are typing): 示例(管道符号“|”是光标的位置,AKA是显示您键入位置的东西):

Eclipse: 日食:

Before pressing enter: 在按Enter之前:

public void example(){|}

After pressing enter: 按下回车后:

public void example(){
    |
}

NetBeans: NetBeans的:

Before pressing enter: 在按Enter之前:

public void example(){|}

After pressing enter: 按下回车后:

public void example(){
|}

try Editing Code Templates 尝试编辑代码模板

1.Choose Tools > Options > Editor > Code Templates. 1.选择工具>选项>编辑器>代码模板。

2.From the Language drop down list, select Java (or whichever language you want to create a code template for). 2.从语言下拉列表中,选择Java(或您要为其创建代码模板的语言)。 The list of abbreviations and associated templates is displayed. 将显示缩写列表和相关模板。

3.Use the New and Remove buttons to add or remove templates in the list. 3.使用“新建”和“删除”按钮在列表中添加或删除模板。 To edit an existing template, select the template and edit the code in the Expanded Text field below the list. 要编辑现有模板,请选择模板并在列表下方的“扩展文本”字段中编辑代码。

4.Choose the key which will be used to expand the templates. 4.选择将用于扩展模板的密钥。 The default key is Tab. 默认键是Tab。

To more about Code Assistance learn here: 有关Code Assistance的更多信息,请访问:
https://netbeans.org/kb/73/java/editor-codereference.html https://netbeans.org/kb/73/java/editor-codereference.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM