All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jp.kyasu.graphics.FontModifier

java.lang.Object
   |
   +----jp.kyasu.graphics.Modifier
           |
           +----jp.kyasu.graphics.FontModifier

public class FontModifier
extends Modifier
The FontModifier class implements the modifier that can create the modified version of the immutable extended font object.

An example of the modification is:

     ExtendedFont exFont = new ExtendedFont("SansSerif", Font.PLAIN, 12);
     FontModifier modifier = new FontModifier();
     modifier.put(FontModifier.BOLD,  true);
     modifier.put(FontModifier.SIZE,  14);
     modifier.put(FontModifier.COLOR, Color.red);
     exFont = modifier.modify(exFont);
         // exFont: new ExtendedFont("SansSerif", Font.BOLD, 14, Color.red)
     modifier.clear();
     modifier.put(FontModifier.ITALIC,    true);
     modifier.put(FontModifier.SIZE_DIFF, -2);
     modifier.put(FontModifier.COLOR,     FontModifier.NULL);
     exFont = modifier.modify(exFont);
         // exFont: new ExtendedFont("SansSerif", Font.BOLD | Font.ITALIC, 12)
 

Version:
08 May 1998
Author:
Kazuki YASUMATSU
See Also:
ExtendedFont

Variable Index

 o BOLD
The constant for the attribute "bold".
 o COLOR
The constant for the attribute "color".
 o ITALIC
The constant for the attribute "italic".
 o NAME
The constant for the attribute "name".
 o SIZE
The constant for the attribute "size".
 o SIZE_DIFF
The constant for the attribute "size".
 o UNDERLINE
The constant for the attribute "underline".

Constructor Index

 o FontModifier()
Constructs an empty font modifier.
 o FontModifier(FontModifier)
Constructs a font modifier that has the same attributes and values as the specified font modifier.

Method Index

 o deriveCleanFontModifier()
Creates a new font modifier by removing the attributes whose value is "NULL".
 o modify(ExtendedFont)
Modifies the given extended font, i.e., Creates the modified version of the given extended font.

Variables

 o NAME
 public static final String NAME
The constant for the attribute "name". The value of this attribute should be a String.

 o BOLD
 public static final String BOLD
The constant for the attribute "bold". The value of this attribute should be a boolean.

See Also:
BOLD
 o ITALIC
 public static final String ITALIC
The constant for the attribute "italic". The value of this attribute should be a boolean.

See Also:
ITALIC
 o SIZE
 public static final String SIZE
The constant for the attribute "size". The value of this attribute should be an integer.

 o SIZE_DIFF
 public static final String SIZE_DIFF
The constant for the attribute "size". The value of this attribute should be an integer. The modification is done by adding the specified size to the size of the font to be modified.

 o COLOR
 public static final String COLOR
The constant for the attribute "color". The value of this attribute should be a Color.

 o UNDERLINE
 public static final String UNDERLINE
The constant for the attribute "underline". The value of this attribute should be a boolean.

Constructors

 o FontModifier
 public FontModifier()
Constructs an empty font modifier.

 o FontModifier
 public FontModifier(FontModifier modifier)
Constructs a font modifier that has the same attributes and values as the specified font modifier.

Parameters:
modifier - the font modifier.

Methods

 o deriveCleanFontModifier
 public FontModifier deriveCleanFontModifier()
Creates a new font modifier by removing the attributes whose value is "NULL".

 o modify
 public ExtendedFont modify(ExtendedFont exFont)
Modifies the given extended font, i.e., Creates the modified version of the given extended font.

Parameters:
exFont - the given extended font.
Returns:
the modified version of the given extended font; or the given extended font, if the modification has no effect on the given extended font.

All Packages  Class Hierarchy  This Package  Previous  Next  Index