< prev index next >

src/java.desktop/share/classes/sun/swing/DefaultLookup.java

Print this page




  49      */
  50     private static final Object DEFAULT_LOOKUP_KEY = new
  51                                         StringBuffer("DefaultLookup");
  52     /**
  53      * Thread that last asked for a default.
  54      */
  55     private static Thread currentDefaultThread;
  56     /**
  57      * DefaultLookup for last thread.
  58      */
  59     private static DefaultLookup currentDefaultLookup;
  60 
  61     /**
  62      * If true, a custom DefaultLookup has been set.
  63      */
  64     private static boolean isLookupSet;
  65 
  66 
  67     /**
  68      * Sets the DefaultLookup instance to use for the current
  69      * <code>AppContext</code>. Null implies the UIManager should be
  70      * used.
  71      */
  72     public static void setDefaultLookup(DefaultLookup lookup) {
  73         synchronized(DefaultLookup.class) {
  74             if (!isLookupSet && lookup == null) {
  75                 // Null was passed in, and no one has invoked setDefaultLookup
  76                 // with a non-null value, we don't need to do anything.
  77                 return;
  78             }
  79             else if (lookup == null) {
  80                 // null was passed in, but someone has invoked setDefaultLookup
  81                 // with a non-null value, use an instance of DefautLookup
  82                 // which will fallback to UIManager.
  83                 lookup = new DefaultLookup();
  84             }
  85             isLookupSet = true;
  86             AppContext.getAppContext().put(DEFAULT_LOOKUP_KEY, lookup);
  87             currentDefaultThread = Thread.currentThread();
  88             currentDefaultLookup = lookup;
  89         }




  49      */
  50     private static final Object DEFAULT_LOOKUP_KEY = new
  51                                         StringBuffer("DefaultLookup");
  52     /**
  53      * Thread that last asked for a default.
  54      */
  55     private static Thread currentDefaultThread;
  56     /**
  57      * DefaultLookup for last thread.
  58      */
  59     private static DefaultLookup currentDefaultLookup;
  60 
  61     /**
  62      * If true, a custom DefaultLookup has been set.
  63      */
  64     private static boolean isLookupSet;
  65 
  66 
  67     /**
  68      * Sets the DefaultLookup instance to use for the current
  69      * {@code AppContext}. Null implies the UIManager should be
  70      * used.
  71      */
  72     public static void setDefaultLookup(DefaultLookup lookup) {
  73         synchronized(DefaultLookup.class) {
  74             if (!isLookupSet && lookup == null) {
  75                 // Null was passed in, and no one has invoked setDefaultLookup
  76                 // with a non-null value, we don't need to do anything.
  77                 return;
  78             }
  79             else if (lookup == null) {
  80                 // null was passed in, but someone has invoked setDefaultLookup
  81                 // with a non-null value, use an instance of DefautLookup
  82                 // which will fallback to UIManager.
  83                 lookup = new DefaultLookup();
  84             }
  85             isLookupSet = true;
  86             AppContext.getAppContext().put(DEFAULT_LOOKUP_KEY, lookup);
  87             currentDefaultThread = Thread.currentThread();
  88             currentDefaultLookup = lookup;
  89         }


< prev index next >