Search code examples
javauser-interfacenetbeansjtree

Netbeans GUI Builder: how to edit generated code


Im using Netbeans GUI Builder and I am adding a JTree to my form, as it does Netbeans is generating all the code for the JTree.

What i want to know is, is there a way in Netbeans to add code to the generated code... like in the source view in the Generated Code section it creates

jTree = new javax.swing.JTree();

i want to add populateJTree.addNodes(null, folder) so it looks like

jTree = new javax.swing.JTree(populateJTree.addNodes(null, folder));

Is there a way of doing this


Solution

  • i sorted it, if you go to the Properties window for the JTree and the Code section, you can add

    new javax.swing.JTree(populateJTree.addNodes(null, folder));

    to the custom creation code part and it will create

    jTree = new javax.swing.JTree(populateJTree.addNodes(null, folder));