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.
  • Field Details

  • Constructor Details

    • DefaultsList

      public DefaultsList()
      Creates a DefaultsList.
  • Method Details

    • add

      public void add(Object key, Object value)
      Adds a key/value pair to the defaults list. This implementation defers to add(Object, Object, boolean) with enableChecking set to true.
      Parameters:
      key - the key that will be used to query UIDefaults
      value - the value associated with the key
      Throws:
      NullPointerException - if key is null
      IllegalArgumentException - if value is a type that should be a UIResource but is not. For instance, passing in a Border that is not a UIResource 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 a null value is treated specially. A null-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 query UIDefaults
      value - the value associated with the key
      enableChecking - if true then the value is checked to ensure that it is a UIResource, if appropriate
      Throws:
      NullPointerException - if key is null
      IllegalArgumentException - if value is a type that should be a UIResource but is not. For instance, passing in a Border that is not a UIResource will cause an exception. This checking must be enabled.
    • asUIResource

      private static <T> T asUIResource(T value, String message)
    • 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