UIDefaults.ProxyLazyValue(String c, Object[] o) : UIDefaults « javax.swing « Java by API






UIDefaults.ProxyLazyValue(String c, Object[] o)

 
import java.awt.BorderLayout;
import java.awt.Color;

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 MainClass {
  public static void main(String args[]) {
    JFrame frame = new JFrame("Lazy Example");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    Object iconObject = LookAndFeel.makeIcon(MainClass.class, "yourImage.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);

    frame.add(scrollPane, BorderLayout.CENTER);
    frame.setSize(200, 200);
    frame.setVisible(true);
  }
}

           
         
  








Related examples in the same category

1.UIDefaults: getBoolean(Object key)
2.UIDefaults: getColor(Object key)
3.UIDefaults: getDimension(Object key)
4.UIDefaults: getFont(Object key)
5.UIDefaults: getIcon(Object key)
6.UIDefaults: getInsets(Object key)
7.UIDefaults: getInt(Object key)
8.implements UIDefaults.ActiveValue