Package com.jgoodies.looks
Class FontPolicies
java.lang.Object
com.jgoodies.looks.FontPolicies
Provides predefined FontPolicy implementations.
Note: The available policies work well on Windows. On other platforms the fonts specified by the runtime environment are chosen. I plan to provide more logic or options for other platforms, for example that a Linux system checks for a Tahoma or Segoe UI.
TODO: Add a check for a custom font policy set in the System properties.
TODO: Add policies that emulate different Windows setups: default XP on 96dpi with normal fonts ("XP-normal-96"), Vista on 120dpi with large fonts ("Vista-large-120"), etc.
- Since:
- 2.0
- Version:
- $Revision: 1.14 $
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
private static final class
Implements the default font lookup for the Plastic Linvalid input: '&f' family when running in a Windows environment.private static class
Implements the default font lookup on the Windows platform.private static final class
A FontPolicy that returns a fixed FontSet and that ignores the laf name and UIDefaults table. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic FontPolicy
createFixedPolicy
(FontSet fontSet) Returns a font policy that in turn always returns the specified FontSet.static FontPolicy
customSettingsPolicy
(FontPolicy defaultPolicy) Returns a font policy that checks for a custom FontPolicy and a custom FontSet specified in the System settings or UIManager.private static FontSet
getCustomFontSet
(String lafName) Looks up and returns a custom FontSet for the given Look&Feel name, ornull
if no custom font set has been defined for this Look&Feel.private static FontPolicy
getCustomPolicy
(String lafName) Looks up and returns a custom FontPolicy for the given Look&Feel name, ornull
if no custom policy has been defined for this Look&Feel.static FontPolicy
Returns the default font policy for Plastic on the Windows platform.static FontPolicy
Returns the default Plastic FontPolicy that may vary with the platform and environment.static FontPolicy
Returns the default font policy for the Windows platform.static FontPolicy
Returns a font policy that returns the logical fonts as specified by the Java runtime environment.
-
Constructor Details
-
FontPolicies
private FontPolicies()
-
-
Method Details
-
createFixedPolicy
Returns a font policy that in turn always returns the specified FontSet. The FontSet will be fixed, but the FontSet itself may return different fonts in different environments.- Parameters:
fontSet
- the FontSet to be return by this policy- Returns:
- a font policy that returns the specified FontSet.
-
customSettingsPolicy
Returns a font policy that checks for a custom FontPolicy and a custom FontSet specified in the System settings or UIManager. If no custom settings are available, the given default policy will be used to look up the FontSet.- Parameters:
defaultPolicy
- the policy used if there are no custom settings- Returns:
- a FontPolicy that checks for custom settings before the default policy is returned.
-
getDefaultPlasticOnWindowsPolicy
Returns the default font policy for Plastic on the Windows platform. It differs from the default Windows policy in that it uses a bold font for TitledBorders, titles, and titled separators.- Returns:
- the default font policy for Plastic on the Windows platform.
-
getDefaultPlasticPolicy
Returns the default Plastic FontPolicy that may vary with the platform and environment. On Windows, the PlasticOnWindowsPolicy is returned that is much like the defualt WindowsPolicy but uses a bold title font. On other Platforms, the logical fonts policy is returned that uses the logical fonts as specified by the Java runtime environment.- Returns:
- a Windows-like policy on Windows, a logical fonts policy on all other platforms
-
getDefaultWindowsPolicy
Returns the default font policy for the Windows platform. It aims to return a FontSet that is close to the native guidelines and useful for the current Java environment.The control font scales with the platform screen resolution (96dpi/101dpi/120dpi/144dpi/...) and honors the desktop font settings (normal/large/extra large).
- Returns:
- the default font policy for the Windows platform.
-
getLogicalFontsPolicy
Returns a font policy that returns the logical fonts as specified by the Java runtime environment.- Returns:
- a font policy that returns logical fonts.
-
getCustomFontSet
Looks up and returns a custom FontSet for the given Look&Feel name, ornull
if no custom font set has been defined for this Look&Feel.- Parameters:
the
- name of the Look&Feel, one of"Plastic"
or"Windows"
- Returns:
- a custom FontPolicy - if any - or otherwise
null
-
getCustomPolicy
Looks up and returns a custom FontPolicy for the given Look&Feel name, ornull
if no custom policy has been defined for this Look&Feel.- Parameters:
the
- name of the Look&Feel, one of"Plastic"
or"Windows"
- Returns:
- a custom FontPolicy - if any - or otherwise
null
-