Package net.sf.freecol.common.resources
Class FontResource
- java.lang.Object
-
- net.sf.freecol.common.resources.Resource
-
- net.sf.freecol.common.resources.FontResource
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.sf.freecol.common.resources.Resource
Resource.Cleanable
-
-
Constructor Summary
Constructors Constructor Description FontResource(java.lang.String primaryKey, java.awt.Font font)
FontResource(java.lang.String primaryKey, java.net.URI resourceLocator)
Do not use directly.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.awt.Font
getEmergencyFont()
Gets a font of last resort, as finding fonts must not fail! Currently using the default Java font, not matter how ugly.java.awt.Font
getFont()
Gets theFont
represented by this resource.void
preload()
Preload the resource if possible/meaningful.-
Methods inherited from class net.sf.freecol.common.resources.Resource
getPrimaryKey, getResourceLocator
-
-
-
-
Field Detail
-
logger
private static final java.util.logging.Logger logger
-
SCHEME
public static final java.lang.String SCHEME
- See Also:
- Constant Field Values
-
font
private java.awt.Font font
-
-
Constructor Detail
-
FontResource
public FontResource(java.lang.String primaryKey, java.awt.Font font)
-
FontResource
public FontResource(java.lang.String primaryKey, java.net.URI resourceLocator) throws java.io.IOException
Do not use directly.- Parameters:
primaryKey
- The primary key.resourceLocator
- TheURI
used when loading this resource.- Throws:
java.io.IOException
- if unable to read the font.
-
-
Method Detail
-
preload
public void preload()
Preload the resource if possible/meaningful.
-
getFont
public java.awt.Font getFont()
Gets theFont
represented by this resource. As failure to load a critical font might remove the ability to even display an error message, it is too risky to allow this routine to return null. Hence the emergency font use.- Returns:
- The
Font
for this resource, or the default Java font if none found.
-
getEmergencyFont
public static java.awt.Font getEmergencyFont()
Gets a font of last resort, as finding fonts must not fail! Currently using the default Java font, not matter how ugly.- Returns:
- The default Java font.
-
-