net.sf.freecol.common.resources
Class FontResource

java.lang.Object
  extended by net.sf.freecol.common.resources.Resource
      extended by net.sf.freecol.common.resources.FontResource

public class FontResource
extends Resource

A Resource wrapping a Font.

See Also:
Resource, Font

Field Summary
private  java.awt.Font font
           
private static java.util.logging.Logger logger
           
static java.lang.String SCHEME
           
 
Constructor Summary
FontResource(java.awt.Font font)
           
FontResource(java.net.URI resourceLocator)
          Do not use directly.
 
Method Summary
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 the Font represented by this resource.
 void preload()
          Preloading is a noop for this resource type.
 
Methods inherited from class net.sf.freecol.common.resources.Resource
getResourceLocator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.awt.Font font)

FontResource

FontResource(java.net.URI resourceLocator)
       throws java.lang.Exception
Do not use directly.

Parameters:
resourceLocator - The URI used when loading this resource.
Throws:
java.lang.Exception
See Also:
ResourceFactory.createResource(URI)
Method Detail

preload

public void preload()
Preloading is a noop for this resource type.

Specified by:
preload in class Resource

getFont

public java.awt.Font getFont()
Gets the Font 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.