com.jgoodies.looks
Class FontUtils

java.lang.Object
  extended by com.jgoodies.looks.FontUtils

public final class FontUtils
extends Object

Provides convenience behavior to set font defaults. Used by the JGoodies look&feel implementations.

Version:
$Revision: 1.2 $
Author:
Karsten Lentzsch
See Also:
FontSizeHints

Method Summary
static Font getControlFont(UIDefaults table, FontSizeHints hints)
          Computes and answers the control font using the specified UIDefaults and FontSizeHints.
static Font getMenuFont(UIDefaults table, FontSizeHints hints)
          Computes and answers the menu font using the specified UIDefaults and FontSizeHints.
static void initFontDefaults(UIDefaults table, Object controlFont, Object controlBoldFont, Object fixedControlFont, Object menuFont, Object messageFont, Object toolTipFont, Object windowFont)
          Sets different fonts to all known widget defaults.
static boolean useSystemFontSettings()
          Checks and answers if we shall use system font settings.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

useSystemFontSettings

public static boolean useSystemFontSettings()
Checks and answers if we shall use system font settings. Using the fonts set by the user can potentially cause performance and compatibility issues, so we allow this feature to be switched off either at runtime or programmatically.

First checks whether system fonts have been explicitly turned off in the system properties. Then checks whether a property has been set in the UIManager.

Returns:
true if system fonts shall be used

initFontDefaults

public static void initFontDefaults(UIDefaults table,
                                    Object controlFont,
                                    Object controlBoldFont,
                                    Object fixedControlFont,
                                    Object menuFont,
                                    Object messageFont,
                                    Object toolTipFont,
                                    Object windowFont)
Sets different fonts to all known widget defaults. If the specified menuFont is null, the given defaults won't be overriden.

Parameters:
table - the UIDefaults table used to set fonts
controlFont - the control font to be set
controlBoldFont - a bold version of the control font
fixedControlFont - a fixed size control font
menuFont - the font used for menus
messageFont - the font used in message
toolTipFont - the font used in tool tips
windowFont - the general dialog font

getMenuFont

public static Font getMenuFont(UIDefaults table,
                               FontSizeHints hints)
Computes and answers the menu font using the specified UIDefaults and FontSizeHints.

The defaults can be overriden using the system property "jgoodies.menuFont". You can set this property either by setting VM runtime arguments, e.g.

   -Djgoodies.menuFont=Tahoma-PLAIN-11
 
or by setting them during the application startup process, e.g.
   System.setProperty(Options.MENU_FONT_KEY, "dialog-BOLD-12");
 

Parameters:
table - the UIDefaults table to work with
hints - the FontSizeHints used to determine the menu font
Returns:
the menu font for the given defaults and hints

getControlFont

public static Font getControlFont(UIDefaults table,
                                  FontSizeHints hints)
Computes and answers the control font using the specified UIDefaults and FontSizeHints.

The defaults can be overriden using the system property "jgoodies.controlFont". You can set this property either by setting VM runtime arguments, e.g.

   -Djgoodies.controlFont=Tahoma-PLAIN-14
 
or by setting them during the application startup process, e.g.
   System.setProperty(Options.CONTROL_FONT_KEY, "Arial-ITALIC-12");
 

Parameters:
table - the UIDefaults table to work with
hints - the FontSizeHints used to determine the control font
Returns:
the control font for the given defaults and hints


Copyright © 2001-2005 JGoodies Karsten Lentzsch. All Rights Reserved.