public final class ComponentUtil
extends java.lang.Object
Constructor and Description |
---|
ComponentUtil() |
Modifier and Type | Method and Description |
---|---|
static java.awt.Component |
findParentByCondition(java.awt.Component c,
java.util.function.Predicate<? super java.awt.Component> condition) |
static java.awt.Component |
findUltimateParent(java.awt.Component c) |
static java.awt.Window |
getActiveWindow() |
static <T> T |
getClientProperty(javax.swing.JComponent component,
Key<T> key) |
static <T> T |
getParentOfType(java.lang.Class<? extends T> type,
java.awt.Component component)
Searches above in the component hierarchy starting from the specified component.
|
static java.awt.Window |
getWindow(java.awt.Component component)
Returns the first window ancestor of the component.
|
static boolean |
isDisableAutoRequestFocus() |
static boolean |
isMinimized(java.awt.Window window) |
static <T> void |
putClientProperty(javax.swing.JComponent component,
Key<T> key,
T value) |
public static <T> T getClientProperty(javax.swing.JComponent component, Key<T> key)
public static <T> void putClientProperty(javax.swing.JComponent component, Key<T> key, T value)
public static boolean isDisableAutoRequestFocus()
public static boolean isMinimized(java.awt.Window window)
public static java.awt.Window getActiveWindow()
public static java.awt.Component findUltimateParent(java.awt.Component c)
public static java.awt.Window getWindow(java.awt.Component component)
component
- the component used to find corresponding windownull
if the component is not a window and is not contained inside a windowpublic static java.awt.Component findParentByCondition(java.awt.Component c, java.util.function.Predicate<? super java.awt.Component> condition)
public static <T> T getParentOfType(java.lang.Class<? extends T> type, java.awt.Component component)
type
- expected classcomponent
- initial componentnull
if the search is failedSwingUtilities.getAncestorOfClass(java.lang.Class<?>, java.awt.Component)