Setting a UI Default Value That Is Created When Fetched : UIDefault « Swing « Java Tutorial






import javax.swing.JPanel;
import javax.swing.UIDefaults;
import javax.swing.UIManager;

public class Main {
  public static void main(String[] argv) {
    Object lazyValue = new UIDefaults.LazyValue() {
      public Object createValue(UIDefaults table) {
        return new JPanel();
      }
    };
    UIManager.put("key", lazyValue);
    Object value = UIManager.get("key");
  }
}








14.121.UIDefault
14.121.1.UIDefaults ClassUIDefaults Class
14.121.2.Setting a UI Default Value That Is Created at Every Fetch
14.121.3.Setting a UI Default Value That Is Created When Fetched
14.121.4.Getting the Default Values for a Look and Feel
14.121.5.Listing UIDefault Properties
14.121.6.Changing ToolTip background color for Swing Applications
14.121.7.Get default values for Swing-based user interface