Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.ka2ddo.yaac.gui
Class FontCache

    java.lang.Object
      org.ka2ddo.yaac.gui.FontCache

All Implemented Interfaces:
  java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.awt.Font>>

    public class FontCache

extends java.lang.Object
implements java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.awt.Font>>

This is a place to keep the font choices used for some of the GUI rendering in YAAC.

Method Summary
`void` | `addFontChangeListener(FontChangeListener l)` Register a listener to be informed when the user changes font selections.
`java.awt.Font` | `getFont(java.lang.String category)` Get the font to use for a a particular GUI category.
`static FontCache` | `getInstance()` Get a reference to the singleton FontCache
`java.util.Iterator<java.util.Map.Entry<java.lang.String,java.awt.Font>>` | `iterator()` Create an Iterator for scanning through the configured Fonts.
`void` | `removeFontChangeListener(FontChangeListener l)` Unregister a listener from being informed of user font selection changes.
`void` | `setFont(java.lang.String category, java.awt.Font f)` Set the font to use for the logical font category.
`static void` | `setupJComponentForFonts(javax.swing.JComponent comp)` Helper method to configure an arbitrary JComponent to get its font updated when the user font choice is changed.
`static void` | `setupJFrameForMenuFonts(javax.swing.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`

Method Detail

### getInstance

    public static FontCache getInstance()

  Get a reference to the singleton FontCache

  Returns:
    FontCache object

### getFont

    public java.awt.Font getFont(java.lang.String category)

  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

    public void setFont(java.lang.String category,
                        java.awt.Font f)

  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 class
    `f` - the Font to associate with the category

### iterator

    public java.util.Iterator<java.util.Map.Entry<java.lang.String,java.awt.Font>> iterator()

  Create an Iterator for scanning through the configured Fonts.

  Specified by:
    `iterator` in interface `java.lang.Iterable<java.util.Map.Entry<java.lang.String,java.awt.Font>>`
  Returns:
    an entrySet Iterator for the font map

### addFontChangeListener

    public void addFontChangeListener(FontChangeListener l)

  Register a listener to be informed when the user changes font selections.

  Parameters:
    `l` - FontChangeListener to register

### removeFontChangeListener

    public void removeFontChangeListener(FontChangeListener l)

  Unregister a listener from being informed of user font selection changes.

  Parameters:
    `l` - FontChangeListener to unregister

### setupJFrameForMenuFonts

    public static void setupJFrameForMenuFonts(javax.swing.JFrame frame)

  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

    public static void setupJComponentForFonts(javax.swing.JComponent comp)

  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

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD