/ Published in: Java

This code snippet uses the UIManager to add icons to JTree nodes.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import java.io.File; import java.net.URL; import javax.swing.UIManager; import javax.swing.JFrame; import javax.swing.JTree; import javax.swing.JScrollPane; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.TreePath; import javax.swing.JOptionPane; import javax.swing.Icon; import javax.swing.ImageIcon; public Program(){ root.add(node1); root.add(node2); root.add(node3); root.add(node4); this.getContentPane().add(treeView); } Program p = new Program(); p.setSize(300,400); p.setVisible(true); } }
URL: http://www.hostprojects.net/snippets/java/141/add-icon-to-jtree-nodes-using-the-uimanager
Comments
