Setting a UI Default Value That Is Created at Every Fetch : UI « Swing JFC « Java






Setting a UI Default Value That Is Created at Every Fetch

  

import java.util.Date;

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

public class Main {
  public static void main(String[] argv) {
    Object activeValue = new UIDefaults.ActiveValue() {
      public Object createValue(UIDefaults table) {
        return new Date();
      }
    };

    UIManager.put("key", activeValue);

    Date d1 = (Date) UIManager.get("key");
    Date d2 = (Date) UIManager.get("key");
    boolean b = d1.equals(d2); // false
  }
}

   
    
  








Related examples in the same category

1.Setting a UI Default Value That Is Created When Fetched
2.Getting the Default Values for a Look and Feel
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.