Package codedraw.textformat
Class TextFormat
java.lang.Object
codedraw.textformat.TextFormat
public final class TextFormat
extends java.lang.Object
TextFormat is used to specify how CodeDraw formats, places and styles its drawn text.
See also
CodeDraw.drawText(double, double, String)-
Constructor Summary
Constructors Constructor Description TextFormat() -
Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object o)java.lang.StringgetFontName()Defines the font of the drawn text.intgetFontSize()Defines the font size of the drawn text.HorizontalAligngetHorizontalAlign()Defines the horizontal alignment of the drawn text.UnderlinegetUnderline()Defines the underline styling of the drawn text.VerticalAligngetVerticalAlign()Defines the vertical alignment of the drawn text.inthashCode()booleanisBold()Defines whether the drawn text is bold.voidisBold(boolean isBold)Defines whether the drawn text is bold.booleanisItalic()Defines whether the drawn text is italic.voidisItalic(boolean isItalic)Defines whether the drawn text is italic.booleanisStrikethrough()Defines whether the drawn text is strikethrough.voidisStrikethrough(boolean strikethrough)Defines whether the drawn text is strikethrough.voidsetFontName(java.lang.String fontName)Defines the font of the drawn text.voidsetFontSize(int fontSize)Defines the font size of the drawn text.voidsetHorizontalAlign(HorizontalAlign horizontalAlign)Defines the horizontal alignment of the drawn text.voidsetUnderlined(Underline underline)Defines the underline styling of the drawn text.voidsetVerticalAlign(VerticalAlign verticalAlign)Defines the vertical alignment of the drawn text.java.lang.StringtoString()Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Constructor Details
-
TextFormat
public TextFormat()
-
-
Method Details
-
getHorizontalAlign
Defines the horizontal alignment of the drawn text. The default is HorizontalAlign.LEFT.- Returns:
- Returns the horizontal alignment.
-
setHorizontalAlign
Defines the horizontal alignment of the drawn text. The default is HorizontalAlign.LEFT.- Parameters:
horizontalAlign- Sets the horizontal alignment.
-
getVerticalAlign
Defines the vertical alignment of the drawn text. The default is VerticalAlign.TOP- Returns:
- Returns the vertical alignment.
-
setVerticalAlign
Defines the vertical alignment of the drawn text. The default is VerticalAlign.TOP- Parameters:
verticalAlign- Sets the vertical alignment.
-
getFontSize
public int getFontSize()Defines the font size of the drawn text. The default is 16.- Returns:
- Returns the font size.
-
setFontSize
public void setFontSize(int fontSize)Defines the font size of the drawn text. The default is 16.- Parameters:
fontSize- Sets the font size.
-
getFontName
public java.lang.String getFontName()Defines the font of the drawn text. The default font is Arial.- Returns:
- Returns the font name.
-
setFontName
public void setFontName(java.lang.String fontName)Defines the font of the drawn text. The default font is Arial.- Parameters:
fontName- Sets the font name. Only accepts valid fonts installed on the system running this application.
-
isBold
public boolean isBold()Defines whether the drawn text is bold. The default is false (not bold).- Returns:
- Returns whether the drawn text is bold.
-
isBold
public void isBold(boolean isBold)Defines whether the drawn text is bold. The default is false (not bold).- Parameters:
isBold- Sets whether the drawn text is bold.
-
isItalic
public boolean isItalic()Defines whether the drawn text is italic. The default is false (not italic).- Returns:
- Returns whether the drawn text is italic.
-
isItalic
public void isItalic(boolean isItalic)Defines whether the drawn text is italic. The default is false (not italic).- Parameters:
isItalic- Sets whether the drawn text is italic.
-
getUnderline
Defines the underline styling of the drawn text. The default is Underline.NONE.- Returns:
- Returns the underline styling.
-
setUnderlined
Defines the underline styling of the drawn text. The default is Underline.NONE.- Parameters:
underline- Sets the underline styling.
-
isStrikethrough
public boolean isStrikethrough()Defines whether the drawn text is strikethrough. The default is false (no strikethrough).- Returns:
- Returns whether the drawn text is strikethrough.
-
isStrikethrough
public void isStrikethrough(boolean strikethrough)Defines whether the drawn text is strikethrough. The default is false (no strikethrough).- Parameters:
strikethrough- Sets whether the drawn text is strikethrough.
-
equals
public boolean equals(java.lang.Object o)- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
-