|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.wordpress.tipsforjava.swing.SwingUtils
public final class SwingUtils extends Object
A collection of utility methods for Swing.
| Field Summary | |
|---|---|
static Set |
setExclude
Exclude methods that return values that are meaningless to the user |
| Constructor Summary | |
private SwingUtils()
|
|
| Method Summary | |
|---|---|
static boolean
|
equals(Object obj1, Object obj2)
Convenience method for determining whether two objects are either equal or both null. |
private static Object
|
getComponentFromList(Class clazz, List list, String property, Object value)
|
static Map
|
getComponentMap(JComponent container, boolean nested)
Convenience method for mapping a container in the hierarchy to its contained components. |
static Object
|
getDescendantOfClass(Class clazz, Container container, String property, Object value)
Convenience method that searches below |
static Object
|
getDescendantOfClass(Class clazz, Container container, String property, Object value, boolean nested)
Convenience method that searches below |
static Object
|
getDescendantOfType(Class clazz, Container container, String property, Object value)
Convenience method that searches below |
static Object
|
getDescendantOfType(Class clazz, Container container, String property, Object value, boolean nested)
Convenience method that searches below |
static List
|
getDescendantsOfClass(Class clazz, Container container)
Convenience method for searching below |
static List
|
getDescendantsOfClass(Class clazz, Container container, boolean nested)
Convenience method for searching below |
static List
|
getDescendantsOfType(Class clazz, Container container)
Convenience method for searching below |
static List
|
getDescendantsOfType(Class clazz, Container container, boolean nested)
Convenience method for searching below |
static Class
|
getJClass(Object component)
Convenience method to obtain the Swing class from which this component was directly or indirectly derived. |
static Map
|
getProperties(JComponent component)
Convenience method for obtaining most non-null human readable properties of a JComponent. |
static Object
|
getUIDefaultOfClass(Class clazz, String property)
Convenience method for retrieving the UIDefault for a single property of a particular class. |
static UIDefaults
|
getUIDefaultsOfClass(Class clazz)
Convenience method for retrieving a subset of the UIDefaults pertaining to a particular class. |
static UIDefaults
|
getUIDefaultsOfClass(String className)
Convenience method for retrieving a subset of the UIDefaults pertaining to a particular class. |
| Methods inherited from class Object | |
|---|---|
| wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
| Field Detail |
|---|
static Set setExclude
| Constructor Detail |
|---|
private SwingUtils()
| Method Detail |
|---|
public static boolean equals(Object obj1, Object obj2)
obj1 - the first reference object to compare.obj2 - the second reference object to compare.
private static Object getComponentFromList(Class clazz, List list, String property, Object value)
public static Map getComponentMap(JComponent container, boolean nested)
Implementation note: The returned value is a HashMap and the values are of type ArrayList. This is subject to change, so callers should code against the interfaces Map and List.
container - The JComponent to be mappednested - true to drill down to nested containers, false otherwise
public static Object getDescendantOfClass(Class clazz, Container container, String property, Object value)
container in the
component hierarchy in a depth first manner and returns the first
found component of class clazz having the bound property
value.
Returns null if such component cannot be found.
This method invokes getDescendantOfClass(clazz, container, property, value, true)
clazz - the class of component to be found.container - the container at which to begin the searchproperty - the className of the bound property, exactly as expressed in
the accessor e.g. "Text" for getText(), "Value" for getValue().
This parameter is case sensitive.value - the value of the bound property
public static Object getDescendantOfClass(Class clazz, Container container, String property, Object value, boolean nested)
container in the
component hierarchy in a depth first manner and returns the first
found component of class clazz having the bound property
value.
Returns null if such component cannot be found.
clazz - the class of component to be found.container - the container at which to begin the searchproperty - the className of the bound property, exactly as expressed
in the accessor e.g. "Text" for getText(), "Value" for getValue().
This parameter is case sensitive.value - the value of the bound propertynested - true to include components nested within another listed
component, false otherwise
public static Object getDescendantOfType(Class clazz, Container container, String property, Object value)
container in the
component hierarchy and returns the first found component that is an
instance of class clazz having the bound property value.
Returns null if such component cannot be found.
This method invokes getDescendantOfType(clazz, container, property, value, true)
clazz - the class of component whose instance is to be found.container - the container at which to begin the searchproperty - the className of the bound property, exactly as expressed in
the accessor e.g. "Text" for getText(), "Value" for getValue().value - the value of the bound property
public static Object getDescendantOfType(Class clazz, Container container, String property, Object value, boolean nested)
container in the
component hierarchy and returns the first found component that is an
instance of class clazz and has the bound property value.
Returns null if such component cannot be found.clazz - the class of component whose instance to be found.container - the container at which to begin the searchproperty - the className of the bound property, exactly as expressed in
the accessor e.g. "Text" for getText(), "Value" for getValue().value - the value of the bound propertynested - true to list components nested within another component
which is also an instance of clazz, false otherwise
public static List getDescendantsOfClass(Class clazz, Container container)
container in the
component hierarchy and return nested components of class
clazz it finds. Returns an empty list if no such
components exist in the container.
This method invokes getDescendantsOfClass(clazz, container, true)
clazz - the class of components to be found.container - the container at which to begin the search
public static List getDescendantsOfClass(Class clazz, Container container, boolean nested)
container in the
component hierarchy and return nested components of class
clazz it finds. Returns an empty list if no such
components exist in the container.
clazz - the class of components to be found.container - the container at which to begin the searchnested - true to list components nested within another listed
component, false otherwise
public static List getDescendantsOfType(Class clazz, Container container)
container in the
component hierarchy and return nested components that are instances of
class clazz it finds. Returns an empty list if no such
components exist in the container.
Invoking this method with a class parameter of JComponent.class will return all nested components.
This method invokes getDescendantsOfType(clazz, container, true)
clazz - the class of components whose instances are to be found.container - the container at which to begin the search
public static List getDescendantsOfType(Class clazz, Container container, boolean nested)
container in the
component hierarchy and return nested components that are instances of
class clazz it finds. Returns an empty list if no such
components exist in the container.
Invoking this method with a class parameter of JComponent.class will return all nested components.
clazz - the class of components whose instances are to be found.container - the container at which to begin the searchnested - true to list components nested within another listed
component, false otherwise
public static Class getJClass(Object component)
component - The component whose Swing superclass is to be
determined
public static Map getProperties(JComponent component)
Implementation note: The returned value is a HashMap. This is subject to change, so callers should code against the interface Map.
component - the component whose proerties are to be determined
public static Object getUIDefaultOfClass(Class clazz, String property)
clazz - the class of interestproperty - the property to query
public static UIDefaults getUIDefaultsOfClass(Class clazz)
clazz - the class of interest
public static UIDefaults getUIDefaultsOfClass(String className)
className - fully qualified name of the class of interest
Groovy Documentation