Tree open Icon
/*
Definitive Guide to Swing for Java 2, Second Edition
By John Zukowski
ISBN: 1-893115-78-X
Publisher: APress
*/
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import javax.swing.JFrame;
import javax.swing.JScrollPane;
import javax.swing.JTree;
import javax.swing.LookAndFeel;
import javax.swing.UIDefaults;
import javax.swing.UIManager;
public class LazySample {
public static void main(String args[]) {
JFrame frame = new JFrame("Lazy Example");
Object iconObject = LookAndFeel.makeIcon(LazySample.class, "World.gif");
UIManager.put("Tree.leafIcon", iconObject);
Integer fifteen = new Integer(15);
Object lazyArgs[] = new Object[] { Color.green, Boolean.TRUE, fifteen,
fifteen };
Object lazyDiamond = new UIDefaults.ProxyLazyValue("DiamondIcon",
lazyArgs);
UIManager.put("Tree.openIcon", lazyDiamond);
JTree tree = new JTree();
JScrollPane scrollPane = new JScrollPane(tree);
Container contentPane = frame.getContentPane();
contentPane.add(scrollPane, BorderLayout.CENTER);
frame.setSize(200, 200);
frame.setVisible(true);
}
}
Related examples in the same category