Package org.ka2ddo.yaac.gui
Class FontCache
java.lang.Object
org.ka2ddo.yaac.gui.FontCache
This is a place to keep the font choices used for some of the GUI rendering in YAAC.
- Author:
- Andrew Pavlin, KA2DDO
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Register a listener to be informed when the user changes font selections.Get the font to use for a a particular GUI category.static FontCache
Get a reference to the singleton FontCacheiterator()
Create an Iterator for scanning through the configured Fonts.void
Unregister a listener from being informed of user font selection changes.void
Set the font to use for the logical font category.static void
Helper method to configure an arbitrary JComponent to get its font updated when the user font choice is changed.static void
setupJFrameForMenuFonts
(JFrame frame) Helper method for configuring a JFrame to use user-selected fonts for the menu bar.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
getInstance
Get a reference to the singleton FontCache- Returns:
- FontCache object
-
getFont
Get the font to use for a a particular GUI category.- Parameters:
category
- Font family name- Returns:
- the currently preferred Font for this category
-
setFont
Set the font to use for the logical font category.- Parameters:
category
- String name of font category, as taken from the constant Strings in the Font classf
- the Font to associate with the category
-
iterator
Create an Iterator for scanning through the configured Fonts. -
addFontChangeListener
Register a listener to be informed when the user changes font selections.- Parameters:
l
- FontChangeListener to register
-
removeFontChangeListener
Unregister a listener from being informed of user font selection changes.- Parameters:
l
- FontChangeListener to unregister
-
setupJFrameForMenuFonts
Helper method for configuring a JFrame to use user-selected fonts for the menu bar.- Parameters:
frame
- JFrame to initialize with configured sanserif font
-
setupJComponentForFonts
Helper method to configure an arbitrary JComponent to get its font updated when the user font choice is changed.- Parameters:
comp
- JComponent to associate with configured font
-