@API(since="5.3", status=EXPERIMENTAL) public class DynamicStyle extends Object
JComponent.updateUI()
, however,
it requires to sub-class component class.
DynamicStyle
enables to augment the components (e.g. border, font, color)
as LaF changes
Constructor and Description |
---|
DynamicStyle() |
Modifier and Type | Method and Description |
---|---|
static Closeable |
onLaFChange(Runnable action)
Schedules an action to be executed after each Look and Feel change.
|
void |
updateComponentTreeUI(Component root)
Updates UI for the components under a given component.
|
void |
updateLaf()
Re-initializes the current LaF and updates the UI for all the open windows.
|
void |
updateLaf(String className)
Set new look and feel for all the open windows.
|
<T extends JComponent> |
withBorder(T component,
String resource) |
<T extends JComponent> |
withDynamic(T component,
Consumer<T> onUpdateUi)
Attaches a configuration action that is executed when Look and Feel changes.
|
<T extends JComponent> |
withFont(T component,
String resource) |
@API(since="5.3", status=EXPERIMENTAL) public <T extends JComponent> T withDynamic(T component, Consumer<T> onUpdateUi)
Note: the action is executed when withDynamic
is called, and the action is
executed even if the new and the old LaFs are the same.
T
- type of the componentcomponent
- component to updateonUpdateUi
- action to run (immediately and when look and feel changes)@API(since="5.3", status=EXPERIMENTAL) public <T extends JComponent> T withBorder(T component, String resource)
@API(since="5.3", status=EXPERIMENTAL) public <T extends JComponent> T withFont(T component, String resource)
@API(since="5.3", status=EXPERIMENTAL) public static Closeable onLaFChange(Runnable action)
action
- action to execute@API(since="5.3", status=EXPERIMENTAL) public void updateLaf()
@API(since="5.3", status=EXPERIMENTAL) public void updateLaf(String className)
className
- look and feel class name@API(since="5.3", status=EXPERIMENTAL) public void updateComponentTreeUI(Component root)
root
- the root of the hierarchy to updateCopyright © 1998-2019 Apache Software Foundation. All Rights Reserved.