javax.swing
Interface UIDefaults.LazyValue
-
- All Known Implementing Classes:
- UIDefaults.LazyInputMap, UIDefaults.ProxyLazyValue
- Enclosing class:
- UIDefaults
public static interface UIDefaults.LazyValue
This class enables one to store an entry in the defaults table that isn't constructed until the first time it's looked up with one of thegetXXX(key)
methods. Lazy values are useful for defaults that are expensive to construct or are seldom retrieved. The first time aLazyValue
is retrieved its "real value" is computed by callingLazyValue.createValue()
and the real value is used to replace theLazyValue
in theUIDefaults
table. Subsequent lookups for the same key return the real value. Here's an example of aLazyValue
that constructs aBorder
:Object borderLazyValue = new UIDefaults.LazyValue() { public Object createValue(UIDefaults table) { return new BorderFactory.createLoweredBevelBorder(); } }; uiDefaultsTable.put("MyBorder", borderLazyValue);
- See Also:
-
UIDefaults.get(java.lang.Object)
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method and Description Object
createValue(UIDefaults table)
Creates the actual value retrieved from theUIDefaults
table.
-
-
-
Method Detail
createValue
Object createValue(UIDefaults table)
Creates the actual value retrieved from theUIDefaults
table. When an object that implements this interface is retrieved from the table, this method is used to create the real value, which is then stored in the table and returned to the calling method.- Parameters:
-
table
- aUIDefaults
table - Returns:
-
the created
Object
-
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2022, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.