public class BasicTSModifier extends FontModifier implements TextStyleModifier
BasicTSModifier class is a basic implementation of
the interface for the text style modifier.
An example of the modification is:
TextStyle textStyle = new TextStyle("SansSerif", Font.PLAIN, 12);
BasicTSModifier modifier = new BasicTSModifier();
modifier.put(BasicTSModifier.BOLD, true);
modifier.put(BasicTSModifier.SIZE, 14);
modifier.put(BasicTSModifier.COLOR, Color.red);
textStyle = modifier.modify(textStyle);
// textStyle: new TextStyle("SansSerif", Font.BOLD, 14, Color.red)
modifier.clear();
modifier.put(BasicTSModifier.ITALIC, true);
modifier.put(BasicTSModifier.SIZE_DIFF, -2);
modifier.put(BasicTSModifier.COLOR, BasicTSModifier.NULL);
textStyle = modifier.modify(textStyle);
// textStyle: new TextStyle("SansSerif", Font.BOLD | Font.ITALIC, 12)
modifier.clear();
modifier.put(BasicTSModifier.FONT, new Font("Serif", Font.PLAIN, 12));
modifier.put(BasicTSModifier.CLICKABLE, new ClickableTextAction("action"));
textStyle = modifier.modify(textStyle);
// textStyle: new TextStyle("Serif", Font.PLAIN, 12) with action
modifier.clear();
modifier.put(BasicTSModifier.FONT, new ExtendedFont("Monospaced", Font.PLAIN, 14, Color.red));
modifier.put(BasicTSModifier.CLICKABLE, BasicTSModifier.NULL);
textStyle = modifier.modify(textStyle);
// textStyle: new TextStyle("Monospaced", Font.PLAIN, 14, Color.red)
TextStyleModifier,
Modifier,
FontModifier,
直列化された形式| 修飾子とタイプ | フィールドと説明 |
|---|---|
static java.lang.String |
CLICKABLE
The constant for the attribute "clickable".
|
static java.lang.String |
FONT
The constant for the attribute "font".
|
BOLD, COLOR, ITALIC, MIN_FONT_SIZE, NAME, SIZE, SIZE_DIFF, UNDERLINEdescription, NULL| コンストラクタと説明 |
|---|
BasicTSModifier()
Constructs an empty text style modifier.
|
BasicTSModifier(FontModifier modifier)
Constructs a text style modifier that has the same attributes and
values as the specified font modifier.
|
| 修飾子とタイプ | メソッドと説明 |
|---|---|
protected FontModifier |
deriveFontModifier()
Creates a new font modifier by replicating this modifier without
"FONT" and "CLICKABLE" attributes.
|
TextStyle |
modify(TextStyle tStyle)
Modifies the given text style, i.e., Creates the modified version
of the given text style.
|
deriveCleanFontModifier, modifypublic static final java.lang.String FONT
ExtendedFont,
定数フィールド値public static final java.lang.String CLICKABLE
ClickableTextAction,
定数フィールド値public BasicTSModifier()
public BasicTSModifier(FontModifier modifier)
modifier - the font modifier.public TextStyle modify(TextStyle tStyle)
modify インタフェース内 TextStyleModifiertStyle - the given text style.TextStyleModifier.modify(jp.kyasu.graphics.TextStyle)protected FontModifier deriveFontModifier()