import java.awt.BorderLayout;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.LookAndFeel;
import javax.swing.UIManager;
public class LookAndFeelMakeIcon {
public static void main(String args[]) {
JFrame frame = new JFrame("Lazy Example");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Object iconObject = LookAndFeel.makeIcon(LookAndFeelMakeIcon.class, "yourFile.gif");
UIManager.put("Tree.leafIcon", iconObject);
JTree tree = new JTree();
JScrollPane scrollPane = new JScrollPane(tree);
frame.add(scrollPane, BorderLayout.CENTER);
frame.setSize(200, 200);
frame.setVisible(true);
}
}
|