-
- 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
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
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/swing/uidefaults.lazyvalue.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.