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
-
BOLD
- The constant for the attribute "bold".
-
COLOR
- The constant for the attribute "color".
-
ITALIC
- The constant for the attribute "italic".
-
NAME
- The constant for the attribute "name".
-
SIZE
- The constant for the attribute "size".
-
SIZE_DIFF
- The constant for the attribute "size".
-
UNDERLINE
- The constant for the attribute "underline".
-
FontModifier()
- Constructs an empty font modifier.
-
FontModifier(FontModifier)
- Constructs a font modifier that has the same attributes and values as
the specified font modifier.
-
deriveCleanFontModifier()
- Creates a new font modifier by removing the attributes whose value
is "NULL".
-
modify(ExtendedFont)
- Modifies the given extended font, i.e., Creates the modified version
of the given extended font.
NAME
public static final String NAME
- The constant for the attribute "name". The value of this attribute
should be a String.
BOLD
public static final String BOLD
- The constant for the attribute "bold". The value of this attribute
should be a boolean.
- See Also:
- BOLD
ITALIC
public static final String ITALIC
- The constant for the attribute "italic". The value of this attribute
should be a boolean.
- See Also:
- ITALIC
SIZE
public static final String SIZE
- The constant for the attribute "size". The value of this attribute
should be an integer.
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.
COLOR
public static final String COLOR
- The constant for the attribute "color". The value of this attribute
should be a Color.
UNDERLINE
public static final String UNDERLINE
- The constant for the attribute "underline". The value of this attribute
should be a boolean.
FontModifier
public FontModifier()
- Constructs an empty font modifier.
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.
deriveCleanFontModifier
public FontModifier deriveCleanFontModifier()
- Creates a new font modifier by removing the attributes whose value
is "NULL".
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