All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class jp.kyasu.graphics.TextStyle

java.lang.Object
   |
   +----jp.kyasu.graphics.TextStyle

public class TextStyle
extends Object
implements Cloneable, Serializable
The TextStyle class implements the style for the text object. The text style has a font attribute and an action attribute. The action attribute is used for the clickable (sensible) text.

The text style is immutable.

Version:
22 Jun 1998
Author:
Kazuki YASUMATSU
See Also:
Text, ClickableTextAction

Variable Index

 o DEFAULT_STYLE
The default text style constant.

Constructor Index

 o TextStyle(ExtendedFont)
Constructs a text style with the specified extended font.
 o TextStyle(Font)
Constructs a text style with the specified font.
 o TextStyle(Font, Color, boolean)
Constructs a text style with the specified font, color, and underline.
 o TextStyle(String, int, int)
Constructs a text style with the specified name, style and size.
 o TextStyle(String, int, int, boolean)
Constructs a text style with the specified name, style, size and underline.
 o TextStyle(String, int, int, Color)
Constructs a text style with the specified name, style, size and color.
 o TextStyle(String, int, int, Color, boolean)
Constructs a text style with the specified name, style, size, color and underline.

Method Index

 o clone()
Returns a clone of this text style.
 o concreteStyle()
Returns a concrete text style.
 o deriveBoldStyle()
Creates a new style by replicating this style with a bold style.
 o deriveItalicStyle()
Creates a new style by replicating this style with an italic style.
 o deriveStyle(ClickableTextAction)
Creates a new style by replicating this style with a new clickable text action associated with it.
 o deriveStyle(ExtendedFont)
Creates a new style by replicating this style with a new extended font object associated with it.
 o deriveStyle(Font)
Creates a new style by replicating this style with a new font object associated with it.
 o deriveStyle(TextStyleModifier)
Creates a new style by modifying this style by a text style modifier.
 o drawText(Graphics, char[], int, int, boolean, boolean, int, int, int, int, int)
Draws the text with style to the specified graphics object.
 o equals(Object)
Compares two objects for equality.
 o getClickableTextAction()
Returns the clickable text action of this style.
 o getExtendedFont()
Returns the extended font of this style.
 o getFont()
Returns the font of this style.
 o getFontMetrics()
Returns the font metrics for this style.
 o hashCode()
Returns a hashcode for this text style.
 o isClickable()
Checks if this style is clickable (this style has a clickable text action).
 o setClickableTextAction(ClickableTextAction)
Sets the clickable text action of this style to the specified action.
 o toString()
Returns the string representation of this text style.

Variables

 o DEFAULT_STYLE
 public static final TextStyle DEFAULT_STYLE
The default text style constant.

Constructors

 o TextStyle
 public TextStyle(String name,
                  int style,
                  int size)
Constructs a text style with the specified name, style and size.

Parameters:
name - the name of the font.
style - the style of the font.
size - the point size of the font.
 o TextStyle
 public TextStyle(String name,
                  int style,
                  int size,
                  Color color)
Constructs a text style with the specified name, style, size and color.

Parameters:
name - the name of the font.
style - the style of the font.
size - the point size of the font.
color - the color of the font.
 o TextStyle
 public TextStyle(String name,
                  int style,
                  int size,
                  boolean underline)
Constructs a text style with the specified name, style, size and underline.

Parameters:
name - the name of the font.
style - the style of the font.
size - the point size of the font.
underline - the font is underlined.
 o TextStyle
 public TextStyle(String name,
                  int style,
                  int size,
                  Color color,
                  boolean underline)
Constructs a text style with the specified name, style, size, color and underline.

Parameters:
name - the name of the font.
style - the style of the font.
size - the point size of the font.
color - the color of the font.
underline - the font is underlined.
 o TextStyle
 public TextStyle(Font font)
Constructs a text style with the specified font.

Parameters:
font - the font for the style.
 o TextStyle
 public TextStyle(Font font,
                  Color color,
                  boolean underline)
Constructs a text style with the specified font, color, and underline.

Parameters:
font - the font for the style.
color - the color of the font.
underline - the font is underlined.
 o TextStyle
 public TextStyle(ExtendedFont exFont)
Constructs a text style with the specified extended font.

Parameters:
exFont - the extended font for the style.

Methods

 o getExtendedFont
 public ExtendedFont getExtendedFont()
Returns the extended font of this style.

 o getFont
 public Font getFont()
Returns the font of this style.

 o getFontMetrics
 public FontMetrics getFontMetrics()
Returns the font metrics for this style.

 o getClickableTextAction
 public ClickableTextAction getClickableTextAction()
Returns the clickable text action of this style.

Returns:
the clickable text action of this style.
 o setClickableTextAction
 public void setClickableTextAction(ClickableTextAction action)
Sets the clickable text action of this style to the specified action.

Parameters:
action - the clickable text action.
 o isClickable
 public boolean isClickable()
Checks if this style is clickable (this style has a clickable text action).

Returns:
true if this style is clickable (this style has a clickable text action); false otherwise.
 o deriveStyle
 public TextStyle deriveStyle(Font font)
Creates a new style by replicating this style with a new font object associated with it.

Parameters:
font - the font object for the new style.
Returns:
a new style.
 o deriveStyle
 public TextStyle deriveStyle(ExtendedFont exFont)
Creates a new style by replicating this style with a new extended font object associated with it.

Parameters:
exFont - the extended font object for the new style.
Returns:
a new style.
 o deriveStyle
 public TextStyle deriveStyle(ClickableTextAction action)
Creates a new style by replicating this style with a new clickable text action associated with it.

Parameters:
action - the clickable text action for the new style.
Returns:
a new style.
 o deriveStyle
 public TextStyle deriveStyle(TextStyleModifier modifier)
Creates a new style by modifying this style by a text style modifier.

Parameters:
modifier - the text style modifier.
Returns:
a new style.
 o deriveBoldStyle
 public TextStyle deriveBoldStyle()
Creates a new style by replicating this style with a bold style.

Returns:
a new bold style.
 o deriveItalicStyle
 public TextStyle deriveItalicStyle()
Creates a new style by replicating this style with an italic style.

Returns:
a new italic style.
 o concreteStyle
 public TextStyle concreteStyle()
Returns a concrete text style.

Returns:
this text style.
 o drawText
 public void drawText(Graphics g,
                      char text[],
                      int offset,
                      int length,
                      boolean isRunStart,
                      boolean isRunEnd,
                      int x,
                      int y,
                      int width,
                      int height,
                      int baseLine)
Draws the text with style to the specified graphics object. If the text is null, draws the style (text attributes) only.

Parameters:
g - the graphics object.
text - the text to be drawn, or null.
offset - the start offset of the text to be drawn.
length - the number of characters in the text to be drawn.
isRunStart - the offset is run start.
isRunEnd - the offset + length is run end.
x - the left of the drawing area.
y - the top of the drawing area.
width - the width of the drawing area.
height - the height of the drawing area.
baseLine - the base line of the drawing area.
See Also:
TextScanner
 o hashCode
 public int hashCode()
Returns a hashcode for this text style.

Overrides:
hashCode in class Object
 o equals
 public boolean equals(Object anObject)
Compares two objects for equality.

Overrides:
equals in class Object
 o clone
 public Object clone()
Returns a clone of this text style.

Overrides:
clone in class Object
 o toString
 public String toString()
Returns the string representation of this text style.

Overrides:
toString in class Object

All Packages  Class Hierarchy  This Package  Previous  Next  Index