Netbeans generated code
I have a netbeans project that I imported into eclipse. When I use my code formatting style in eclipse, it breaks the auto generated 开发者_Go百科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.
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 is picky about the comments surrounding guarded blocks At issue here is the space between the //
and the GEN
.
The GEN
needs to immediately follow the comment.
Fails, space before GEN:
// GEN_FIRST:event_customActionPerformed
OK, no space before GEN:
//GEN_FIRST:event_customActionPerformed
精彩评论