I've been dealing with this for over a week, and now it's beginning to impede my productivity.
I have a JTextBox that I am applying a custom document filter to. To add this, I right-clicked on the control, went into Customize Code, and added this line beneath everything:
((javax.swing.text.AbstractDocument)jtfTextField.getDocument()).setDocumentFilter(new mylibrary.NumericDocumentFilter());
Now, this was a copy-paste job (as I've used this in other places). The field I wanted to set the filter to is called TextField
. By mistake, I clicked OK, compiled, and it exploded. Duh, I see my mistake. I fix it, recompile, and I still get the error. Now my code has this:
((javax.swing.text.AbstractDocument)TextField.getDocument()).setDocumentFilter(new mylibrary.NumericDocumentFilter());
((javax.swing.text.AbstractDocument)jtfTextField.getDocument()).setDocumentFilter(new mylibrary.NumericDocumentFilter());
And when I go into Customize Code, it just shows the correct (top) one. I close Netbeans, edit the file with Notepad++ and remove the offending line, and start Netbeans back up. Now it compiles, I run it, test, then when I go back, the code regenerated itself with the erroneous line.
I blew out the cache for Netbeans and that did nothing, so I am really at a loss on how to fix this. Any takers?
Netbeans Version 7.3.1.
Update: I snoop'd around a bit and found this in my Topcomponent's *.form file:
<AuxValues>
<AuxValue name="JavaCodeGenerator_AddingCodePost" type="java.lang.String" value="((javax.swing.text.AbstractDocument)jtfTextField.getDocument()).setDocumentFilter(new mylibrary.NumericDocumentFilter());"/>
</AuxValues>
Perhaps deleting this could fix the issue, but I'm not sure, and really don't want to risk destroying this project.