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 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