This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
The possibility for Pre/Post Init/Creation code is a greate feature to keep the code where it should be. BUT: If you edit more than one line, wrong code is generated! To be precise: The line number at which `//GEN-END:initComponents` is inserted is calculated wrong. It appears to be inserted as much lines of code later than lines of Pre-Init-code(...) more than one is edited. Following `//GEN-*` lines appear in the wrong line too. You see the wrong code in the editor not immediately but the next time you start f4j. IF YOU ARE NOT CAREFUL NOW YOU MAY LOOSE PARTS OF YOUR CODE IN THIS SITUATION! If you change the Pre-Init-code(...) code immediately back to one or no line, your code is restored. In the example attached to this mail I started with a JFrame. Then I added a JMenuBar. In the Component Inspector I selected the JMenuBar and added some lines in the property `Post Init Code`. Then you have to save the code and reopen it (best with another text editor) to see the mistakes. public class test extends javax.swing.JFrame { /** Creates new form test */ public test() { initComponents (); pack (); } /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the FormEditor. */ private void initComponents () {//GEN-BEGIN:initComponents jMenuBar1 = new javax.swing.JMenuBar (); jMenu1 = new javax.swing.JMenu (); // post init line 1 // post init line 2 // post init line 3 // post init line 4 // post init line 5 jMenu1.setText ("Menu"); jMenuBar1.add (jMenu1); addWindowListener (new java.awt.event.WindowAdapter () { public void windowClos [PBUZEK] Problem is editor puts #0d #0d #0a at the end of each line. We could repair it here, but I suggest to resolve it in Editor.
Priority is changed to P4 (normal).
verified in [boston](1160) and [release31](33)
Resolved for 3.4.x or earlier, no new info since then -> closing.