Netbeans 生成的代码
我有一个 netbeans 项目,已导入到 eclipse 中。当我在 Eclipse 中使用代码格式化样式时,它会破坏 Netbeans 中自动生成的代码。代码类似于以下内容。
private void customActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_customActionPerformed
// aaa
}// GEN-LAST:event_customActionPerformed
有没有办法告诉 Netbeans 返回并使用正确命名的方法?目前,当我在 GUI Builder 中时,它不会找到之前生成的方法。
I have a netbeans project that I imported into eclipse. When I use my code formatting style in eclipse, it breaks the auto generated code in Netbeans. The code is similar to the following.
private void customActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_customActionPerformed
// aaa
}// GEN-LAST:event_customActionPerformed
Is there any way to tell Netbeans to go back and use the correctly named methods? Currently when I am in the GUI Builder, it will not find the method that it had previously generated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
要避免更改注释:
打开首选项(在窗口菜单中,选择首选项)
在首选项树中,转到“Java”、“代码样式”、“格式化程序”
如果您只想配置单个项目,请单击“配置项目特定设置”链接(看起来像蓝色 URL 链接)
您可能希望创建一个“新”配置文件,从默认配置文件(或用于您的项目的任何内容)复制
当您编辑配置文件时,转到“注释” ”选项卡,然后取消选择“启用行注释格式”。这将防止空格出现在单行注释中。
To avoid altering the comments:
Open the preferences (In the Window menu, select Preferences)
In the Preferences tree, go to "Java", "Code Style", "Formatter"
If you only wish to configure a single project, click the "Configure Project Specific Settings" link (looks like a blue URL link)
You may wish to create a "new" profile, copying from the default (or whatever is used for your project)
When you are editing the profile, go to the "Comments" tab, and deselect "Enable Line Comment Formatting". That will prevent spaces from appearing in single line comments.
NetBeans 对围绕受保护块的注释很挑剔 这里的问题是
//
和GEN
之间的空格。GEN
需要立即跟进该评论。失败,GEN 之前有空格:
好的,GEN 之前没有空格:
NetBeans is picky about the comments surrounding guarded blocks At issue here is the space between the
//
and theGEN
.The
GEN
needs to immediately follow the comment.Fails, space before GEN:
OK, no space before GEN: