Package org.apache.jorphan.gui
Class DynamicStyle
java.lang.Object
org.apache.jorphan.gui.DynamicStyle
By default, Swing does not provide a way to augment components when
 look and feel changes. There's 
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 Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic CloseableonLaFChange(Runnable action) Schedules an action to be executed after each Look and Feel change.voidUpdates UI for the components under a given component.voidRe-initializes the current LaF and updates the UI for all the open windows.voidSet new look and feel for all the open windows.<T extends JComponent>
TwithBorder(T component, String resource) <T extends JComponent>
TwithDynamic(T component, Consumer<? super T> onUpdateUi) Attaches a configuration action that is executed when Look and Feel changes.<T extends JComponent>
T 
- 
Constructor Details
- 
DynamicStyle
public DynamicStyle() 
 - 
 - 
Method Details
- 
withDynamic
@API(since="5.3", status=EXPERIMENTAL) public <T extends JComponent> T withDynamic(T component, Consumer<? super T> onUpdateUi) Attaches a configuration action that is executed when Look and Feel changes.Note: the action is executed when
withDynamicis called, and the action is executed even if the new and the old LaFs are the same.- Type Parameters:
 T- type of the component- Parameters:
 component- component to updateonUpdateUi- action to run (immediately and when look and feel changes)- Returns:
 - input component (e.g. for fluent APIs)
 
 - 
withBorder
@API(since="5.3", status=EXPERIMENTAL) public <T extends JComponent> T withBorder(T component, String resource)  - 
withFont
@API(since="5.3", status=EXPERIMENTAL) public <T extends JComponent> T withFont(T component, String resource)  - 
onLaFChange
Schedules an action to be executed after each Look and Feel change.- Parameters:
 action- action to execute- Returns:
 - a handle that can be used to un-register the listener
 
 - 
updateLaf
@API(since="5.3", status=EXPERIMENTAL) public void updateLaf()Re-initializes the current LaF and updates the UI for all the open windows. - 
updateLaf
Set new look and feel for all the open windows.- Parameters:
 className- look and feel class name
 - 
updateComponentTreeUI
Updates UI for the components under a given component.- Parameters:
 root- the root of the hierarchy to update
 
 -