Class ComponentFontRegistry

java.lang.Object
generic.theme.laf.ComponentFontRegistry

public class ComponentFontRegistry extends Object
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 Details

    • ComponentFontRegistry

      public ComponentFontRegistry(String fontId)
      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

      public void addComponent(Component component)
      Adds a Component 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

      public void addComponent(Component component, int fontStyle)
      Allows clients to update the default font being used for a component to use the given style.
      Parameters:
      component - the component
      fontStyle - the font style (e.g., Font.BOLD)
    • removeComponent

      public void removeComponent(Component component)
      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.