public class TextStyle
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable
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.
Text,
ClickableTextAction,
直列化された形式| 修飾子とタイプ | フィールドと説明 |
|---|---|
protected ClickableTextAction |
action
The clickable text action.
|
static TextStyle |
DEFAULT_STYLE
The default text style constant.
|
protected ExtendedFont |
exFont
The extended font.
|
| コンストラクタと説明 |
|---|
TextStyle(ExtendedFont exFont)
Constructs a text style with the specified extended font.
|
TextStyle(java.awt.Font font)
Constructs a text style with the specified font.
|
TextStyle(java.awt.Font font,
java.awt.Color color,
boolean underline)
Constructs a text style with the specified font, color, and underline.
|
TextStyle(java.lang.String name,
int style,
int size)
Constructs a text style with the specified name, style and size.
|
TextStyle(java.lang.String name,
int style,
int size,
boolean underline)
Constructs a text style with the specified name, style, size
and underline.
|
TextStyle(java.lang.String name,
int style,
int size,
java.awt.Color color)
Constructs a text style with the specified name, style, size
and color.
|
TextStyle(java.lang.String name,
int style,
int size,
java.awt.Color color,
boolean underline)
Constructs a text style with the specified name, style, size,
color and underline.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
protected TextStyle |
basedOn(TextStyle baseStyle)
Creates a new style by modifying this style to be based on the
specified base text style.
|
java.lang.Object |
clone()
Returns a clone of this text style.
|
TextStyle |
concreteStyle()
Returns a concrete text style.
|
TextStyle |
deriveBoldStyle()
Creates a new style by replicating this style with a bold style.
|
TextStyle |
deriveItalicStyle()
Creates a new style by replicating this style with an italic style.
|
TextStyle |
deriveStyle(ClickableTextAction action)
Creates a new style by replicating this style with a new clickable
text action associated with it.
|
TextStyle |
deriveStyle(ExtendedFont exFont)
Creates a new style by replicating this style with a new extended
font object associated with it.
|
TextStyle |
deriveStyle(java.awt.Font font)
Creates a new style by replicating this style with a new font
object associated with it.
|
TextStyle |
deriveStyle(TextStyleModifier modifier)
Creates a new style by modifying this style by a text style
modifier.
|
void |
drawText(java.awt.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.
|
boolean |
equals(java.lang.Object anObject)
Compares two objects for equality.
|
protected boolean |
equalsFontAndAction(TextStyle textStyle)
Compares font attributes and action attributes of two text styles
for equality.
|
ClickableTextAction |
getClickableTextAction()
Returns the clickable text action of this style.
|
ExtendedFont |
getExtendedFont()
Returns the extended font of this style.
|
java.awt.Font |
getFont()
Returns the font of this style.
|
java.awt.FontMetrics |
getFontMetrics()
Returns the font metrics for this style.
|
int |
hashCode()
Returns a hashcode for this text style.
|
boolean |
isClickable()
Checks if this style is clickable (this style has a clickable
text action).
|
void |
setClickableTextAction(ClickableTextAction action)
Sets the clickable text action of this style to the specified action.
|
java.lang.String |
toString()
Returns the string representation of this text style.
|
protected ExtendedFont exFont
protected ClickableTextAction action
public static final TextStyle DEFAULT_STYLE
public TextStyle(java.lang.String name,
int style,
int size)
name - the name of the font.style - the style of the font.size - the point size of the font.public TextStyle(java.lang.String name,
int style,
int size,
java.awt.Color color)
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.public TextStyle(java.lang.String name,
int style,
int size,
boolean underline)
name - the name of the font.style - the style of the font.size - the point size of the font.underline - the font is underlined.public TextStyle(java.lang.String name,
int style,
int size,
java.awt.Color color,
boolean underline)
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.public TextStyle(java.awt.Font font)
font - the font for the style.public TextStyle(java.awt.Font font,
java.awt.Color color,
boolean underline)
font - the font for the style.color - the color of the font.underline - the font is underlined.public TextStyle(ExtendedFont exFont)
exFont - the extended font for the style.public ExtendedFont getExtendedFont()
public java.awt.Font getFont()
public java.awt.FontMetrics getFontMetrics()
public ClickableTextAction getClickableTextAction()
public void setClickableTextAction(ClickableTextAction action)
action - the clickable text action.public boolean isClickable()
true if this style is clickable (this style
has a clickable text action); false otherwise.public TextStyle deriveStyle(java.awt.Font font)
font - the font object for the new style.public TextStyle deriveStyle(ExtendedFont exFont)
exFont - the extended font object for the new style.public TextStyle deriveStyle(ClickableTextAction action)
action - the clickable text action for the new style.public TextStyle deriveStyle(TextStyleModifier modifier)
modifier - the text style modifier.public TextStyle deriveBoldStyle()
public TextStyle deriveItalicStyle()
public TextStyle concreteStyle()
protected TextStyle basedOn(TextStyle baseStyle)
baseStyle - the base text style.Text.baseStyleOn(int, int, jp.kyasu.graphics.TextStyle)public void drawText(java.awt.Graphics g,
char[] text,
int offset,
int length,
boolean isRunStart,
boolean isRunEnd,
int x,
int y,
int width,
int height,
int baseLine)
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.TextScannerpublic int hashCode()
hashCode クラス内 java.lang.Objectpublic boolean equals(java.lang.Object anObject)
equals クラス内 java.lang.Objectprotected boolean equalsFontAndAction(TextStyle textStyle)
public java.lang.Object clone()
clone クラス内 java.lang.Objectpublic java.lang.String toString()
toString クラス内 java.lang.Object