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
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));
Yes there is a way to add code. Just right click on the component (in this example it would be JTree) than choose "Customize code", select "custom creation" and you are good to go.
@SuppressWarnings("unchecked") // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
and in the end of initComponents() method, remove // </editor-fold>//GEN-END:initComponents
// Variables declaration - do not modify//GEN-BEGIN:variables
and // End of variables declaration//GEN-END:variables
see now you can edit the Generated code.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.