# Class TextPainter

java.lang.Object
com.codename1.ui.scene.TextPainter

All Implemented Interfaces:
  `NodePainter`

public class TextPainter extends Object implements NodePainter
A painter for painting text into a Node.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `TextPainter(String text, int valign)`
  Creates a new TextPainter with the given text and vertical alignment.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `getText()`
  The text of this painter.
  `int`
  `getvAlign()`
  Gets the vertical alignment of this text.
  `void`
  `paint(Graphics g, Rectangle bounds, Node node)`
  Paints the text onto the provided graphics context.
  `void`
  `setText(String text)`
  Sets the text of this painter
  `void`
  `setvAlign(int vAlign)`
  Sets the vertical alignment.

  ### Methods inherited from class Object

  `clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### TextPainter

    public TextPainter(String text, int valign)

    Creates a new TextPainter with the given text and vertical alignment.

    ###### Parameters

    - `text`: The text to paint.

    - `valign`: The vertical alignment of the text. One of `Component#CENTER`, `Component#TOP`, `Component#BOTTOM`.

- ## Method Details

  - ### paint

    public void paint(Graphics g, Rectangle bounds, Node node)

    Paints the text onto the provided graphics context.

    ###### Parameters

    - `g`: The graphics to paint onto.

    - `bounds`: The bounding rect.

    - `node`: The node whose content we are painting.

    Specified by:
      `paint` in interface `NodePainter`

  - ### getText

    public String getText()

    The text of this painter.

    ###### Returns

    the text

  - ### setText

    public void setText(String text)

    Sets the text of this painter

    ###### Parameters

    - `text`: the text to set

  - ### getvAlign

    public int getvAlign()

    Gets the vertical alignment of this text. One of `Component#CENTER`, `Component#TOP`, `Component#BOTTOM`.

    ###### Returns

    the vAlign

  - ### setvAlign

    public void setvAlign(int vAlign)

    Sets the vertical alignment. One of `Component#CENTER`, `Component#TOP`, `Component#BOTTOM`.

    ###### Parameters

    - `vAlign`: the vAlign to set