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
-
DEFAULT_STYLE
- The default text style constant.
-
TextStyle(ExtendedFont)
- Constructs a text style with the specified extended font.
-
TextStyle(Font)
- Constructs a text style with the specified font.
-
TextStyle(Font, Color, boolean)
- Constructs a text style with the specified font, color, and underline.
-
TextStyle(String, int, int)
- Constructs a text style with the specified name, style and size.
-
TextStyle(String, int, int, boolean)
- Constructs a text style with the specified name, style, size
and underline.
-
TextStyle(String, int, int, Color)
- Constructs a text style with the specified name, style, size
and color.
-
TextStyle(String, int, int, Color, boolean)
- Constructs a text style with the specified name, style, size,
color and underline.
-
clone()
- Returns a clone of this text style.
-
concreteStyle()
- Returns a concrete text style.
-
deriveBoldStyle()
- Creates a new style by replicating this style with a bold style.
-
deriveItalicStyle()
- Creates a new style by replicating this style with an italic style.
-
deriveStyle(ClickableTextAction)
- Creates a new style by replicating this style with a new clickable
text action associated with it.
-
deriveStyle(ExtendedFont)
- Creates a new style by replicating this style with a new extended
font object associated with it.
-
deriveStyle(Font)
- Creates a new style by replicating this style with a new font
object associated with it.
-
deriveStyle(TextStyleModifier)
- Creates a new style by modifying this style by a text style
modifier.
-
drawText(Graphics, char[], int, int, boolean, boolean, int, int, int, int, int)
- Draws the text with style to the specified graphics object.
-
equals(Object)
- Compares two objects for equality.
-
getClickableTextAction()
- Returns the clickable text action of this style.
-
getExtendedFont()
- Returns the extended font of this style.
-
getFont()
- Returns the font of this style.
-
getFontMetrics()
- Returns the font metrics for this style.
-
hashCode()
- Returns a hashcode for this text style.
-
isClickable()
- Checks if this style is clickable (this style has a clickable
text action).
-
setClickableTextAction(ClickableTextAction)
- Sets the clickable text action of this style to the specified action.
-
toString()
- Returns the string representation of this text style.
DEFAULT_STYLE
public static final TextStyle DEFAULT_STYLE
- The default text style constant.
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.
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.
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.
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.
TextStyle
public TextStyle(Font font)
- Constructs a text style with the specified font.
- Parameters:
- font - the font for the style.
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.
TextStyle
public TextStyle(ExtendedFont exFont)
- Constructs a text style with the specified extended font.
- Parameters:
- exFont - the extended font for the style.
getExtendedFont
public ExtendedFont getExtendedFont()
- Returns the extended font of this style.
getFont
public Font getFont()
- Returns the font of this style.
getFontMetrics
public FontMetrics getFontMetrics()
- Returns the font metrics for this style.
getClickableTextAction
public ClickableTextAction getClickableTextAction()
- Returns the clickable text action of this style.
- Returns:
- the clickable text action of this style.
setClickableTextAction
public void setClickableTextAction(ClickableTextAction action)
- Sets the clickable text action of this style to the specified action.
- Parameters:
- action - the clickable text action.
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.
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.
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.
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.
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.
deriveBoldStyle
public TextStyle deriveBoldStyle()
- Creates a new style by replicating this style with a bold style.
- Returns:
- a new bold style.
deriveItalicStyle
public TextStyle deriveItalicStyle()
- Creates a new style by replicating this style with an italic style.
- Returns:
- a new italic style.
concreteStyle
public TextStyle concreteStyle()
- Returns a concrete text style.
- Returns:
- this text style.
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
hashCode
public int hashCode()
- Returns a hashcode for this text style.
- Overrides:
- hashCode in class Object
equals
public boolean equals(Object anObject)
- Compares two objects for equality.
- Overrides:
- equals in class Object
clone
public Object clone()
- Returns a clone of this text style.
- Overrides:
- clone in class Object
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