Package generic.theme.laf
Class ComponentFontRegistry
java.lang.Object
generic.theme.laf.ComponentFontRegistry
Maintains a weak set of components associated with a given font id. Whenever the font changes
for the font id, this class will update the component's font to the new value.
-
Constructor Summary
ConstructorDescriptionComponentFontRegistry
(String fontId) Constructs a registry for components bound to the given font id -
Method Summary
Modifier and TypeMethodDescriptionvoid
addComponent
(Component component) Adds aComponent
to the weak set of components whose font should be updated when the underlying font changes for this registry's font id.void
addComponent
(Component component, int fontStyle) Allows clients to update the default font being used for a component to use the given style.void
removeComponent
(Component component) Removes the given component from this registry.void
Updates the font for all components bound to this registry's font id.
-
Constructor Details
-
ComponentFontRegistry
Constructs a registry for components bound to the given font id- Parameters:
fontId
- the id of the font to update the containing components
-
-
Method Details
-
addComponent
Adds aComponent
to the weak set of components whose font should be updated when the underlying font changes for this registry's font id.- Parameters:
component
- the component to add
-
addComponent
Allows clients to update the default font being used for a component to use the given style.- Parameters:
component
- the componentfontStyle
- the font style (e.g.,Font.BOLD
)
-
removeComponent
Removes the given component from this registry.- Parameters:
component
- the component
-
updateComponentFonts
public void updateComponentFonts()Updates the font for all components bound to this registry's font id.
-