java.lang.Object
is.codion.swing.common.ui.Utilities
A utility class for UI related things.
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidenabled(ObservableState enabledState, @Nullable Action... actions) Links the given actions to the givenObservableState, so that the actions are enabled only when the observed state is activestatic voidenabled(ObservableState enabledState, @Nullable JComponent... components) Links the given components to the givenObservableState, so that each component is enabled only when the observed state is activestatic voidfocusable(ObservableState focusableState, JComponent... components) Links the given components to the givenObservableState, so that each component is focusable only when the observed state is activestatic ImageIconLoads an icon as a resourcestatic <T> Observer<T> observer(JComponent component, String property) Returns aObservernotified each time the value of the given property changes in the given component.static voidFor focus debug purposes, prints the new and old values to the standard output when the 'focusOwner' value changes in the current keyboard focus manager.static voidsetClipboard(@Nullable String string) Sets the given string as clipboard contentsstatic voidCallsSwingUtilities.updateComponentTreeUI(Component)for all windows.static voidupdateComponentTreeUI(Collection<? extends JComponent> components) CallsSwingUtilities.updateComponentTreeUI(Component)for the given components, ignores null components.static voidupdateComponentTreeUI(@Nullable JComponent... components) CallsSwingUtilities.updateComponentTreeUI(Component)for the given components, ignores null components.static voidupdateUI(Collection<? extends JComponent> components) CallsJComponent.updateUI()for the given components, ignores null components.static voidupdateUI(@Nullable JComponent... components) CallsJComponent.updateUI()for the given components, ignores null components.static voidvisible(ObservableState visibleState, JComponent... components) Links the given components to the givenObservableState, so that each component is visible only when the observed state is active
-
Method Details
-
updateUI
CallsJComponent.updateUI()for the given components, ignores null components.- Parameters:
components- the components to update the UI for
-
updateUI
CallsJComponent.updateUI()for the given components, ignores null components.- Parameters:
components- the components to update the UI for
-
updateComponentTreeUI
CallsSwingUtilities.updateComponentTreeUI(Component)for the given components, ignores null components.- Parameters:
components- the components to update the UI for
-
updateComponentTreeUI
CallsSwingUtilities.updateComponentTreeUI(Component)for the given components, ignores null components.- Parameters:
components- the components to update the UI for
-
updateComponentTreeForAllWindows
public static void updateComponentTreeForAllWindows()CallsSwingUtilities.updateComponentTreeUI(Component)for all windows.- See Also:
-
enabled
Links the given actions to the givenObservableState, so that the actions are enabled only when the observed state is active- Parameters:
enabledState- theObservableStatewith which to link the actionsactions- the actions
-
enabled
Links the given components to the givenObservableState, so that each component is enabled only when the observed state is active- Parameters:
enabledState- theObservableStatewith which to link the componentscomponents- the components
-
visible
Links the given components to the givenObservableState, so that each component is visible only when the observed state is active- Parameters:
visibleState- theObservableStatewith which to link the componentscomponents- the components
-
focusable
Links the given components to the givenObservableState, so that each component is focusable only when the observed state is active- Parameters:
focusableState- theObservableStatewith which to link the componentscomponents- the components
-
observer
Returns aObservernotified each time the value of the given property changes in the given component.- Type Parameters:
T- the property data type- Parameters:
component- the componentproperty- the property to listen to changes for- Returns:
- a
Observernotified each time the value of the given property changes
-
loadIcon
Loads an icon as a resource- Parameters:
resourceClass- the class owning the resourceresourceName- the resource name- Returns:
- an icon
- Throws:
IllegalArgumentException- in case the given resource was not found
-
setClipboard
Sets the given string as clipboard contents- Parameters:
string- the string to put on the clipboard
-
printFocusOwner
public static void printFocusOwner()For focus debug purposes, prints the new and old values to the standard output when the 'focusOwner' value changes in the current keyboard focus manager.
-