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






Setting a UI Default Value That Is Created When Fetched

  

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");
  }
}

   
    
  








Related examples in the same category

1.Getting the Default Values for a Look and Feel
2.Setting a UI Default Value That Is Created at Every Fetch
3.Replaces the standard scrollbar UI with a custom oneReplaces the standard scrollbar UI with a custom one
4.UIManager defaultsUIManager defaults
5.Retrieve information of all available UIManager defaults
6.Get default values for Swing-based user interface
7.How to change the look and feel of Swing applications
8.UIManager resources to tweak the look of applicationsUIManager resources to tweak the look of applications
9.Displays the contents of the UIDefaults hash map for the current look and feel.