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






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
  }
}








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