Package org.jdesktop.swingx.plaf
Class DefaultsList
- java.lang.Object
-
- org.jdesktop.swingx.plaf.DefaultsList
-
public final class DefaultsList extends Object
A specialty "list" for working with UI defaults. Requires adds to be done using key/value pairs. The purpose of this list is to enforce additions as pairs.- Author:
- Karl George Schaefer
-
-
Constructor Summary
Constructors Constructor Description DefaultsList()
Creates aDefaultsList
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(Object key, Object value)
Adds a key/value pair to the defaults list.void
add(Object key, Object value, boolean enableChecking)
Adds a key/value pair to the defaults list.Object[]
toArray()
Gets a copy of this list as an array.
-
-
-
Method Detail
-
add
public void add(Object key, Object value)
Adds a key/value pair to the defaults list. This implementation defers toadd(Object, Object, boolean)
withenableChecking
set totrue
.- Parameters:
key
- the key that will be used to queryUIDefaults
value
- the value associated with the key- Throws:
NullPointerException
- ifkey
isnull
IllegalArgumentException
- ifvalue
is a type that should be aUIResource
but is not. For instance, passing in aBorder
that is not aUIResource
will cause an exception. This checking must be enabled.
-
add
public void add(Object key, Object value, boolean enableChecking)
Adds a key/value pair to the defaults list. A pair with anull
value is treated specially. Anull
-value pair is never added to the list and, furthermore, if a key/value pair exists in this list with the same key as the newly added one, it is removed.- Parameters:
key
- the key that will be used to queryUIDefaults
value
- the value associated with the keyenableChecking
- iftrue
then the value is checked to ensure that it is aUIResource
, if appropriate- Throws:
NullPointerException
- ifkey
isnull
IllegalArgumentException
- ifvalue
is a type that should be aUIResource
but is not. For instance, passing in aBorder
that is not aUIResource
will cause an exception. This checking must be enabled.
-
toArray
public Object[] toArray()
Gets a copy of this list as an array.- Returns:
- an array containing all of the key/value pairs added to this list
-
-