Class TextFormat

java.lang.Object
codedraw.textformat.TextFormat

public final class TextFormat extends Object
TextFormat is used to specify how CodeDraw formats, places and styles its drawn text. See also CodeDraw.drawText(double, double, String) and CodeDrawImage.drawText(double, double, String).
  • Constructor Details

    • TextFormat

      public TextFormat()
  • Method Details

    • getHorizontalAlign

      public HorizontalAlign getHorizontalAlign()
      Defines the horizontal alignment of the drawn text. The default is HorizontalAlign.LEFT.
      Returns:
      the horizontal alignment.
    • setHorizontalAlign

      public void setHorizontalAlign(HorizontalAlign horizontalAlign)
      Defines the horizontal alignment of the drawn text. The default is HorizontalAlign.LEFT.
      Parameters:
      horizontalAlign - Sets the horizontal alignment.
    • getVerticalAlign

      public VerticalAlign getVerticalAlign()
      Defines the vertical alignment of the drawn text. The default is VerticalAlign.TOP
      Returns:
      the vertical alignment.
    • setVerticalAlign

      public void setVerticalAlign(VerticalAlign verticalAlign)
      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:
      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 String getFontName()
      Defines the font of the drawn text. The default font is Arial.
      Returns:
      the font name.
    • setFontName

      public void setFontName(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:
      whether the drawn text is bold.
    • setBold

      public void setBold(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:
      whether the drawn text is italic.
    • setItalic

      public void setItalic(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

      public Underline getUnderline()
      Defines the underline styling of the drawn text. The default is Underline.NONE.
      Returns:
      the underline styling.
    • setUnderlined

      public void setUnderlined(Underline underline)
      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:
      whether the drawn text is strikethrough.
    • setStrikethrough

      public void setStrikethrough(boolean isStrikethrough)
      Defines whether the drawn text is strikethrough. The default is false (no strikethrough).
      Parameters:
      isStrikethrough - Sets whether the drawn text is strikethrough.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object