Class StringPainter


  • public class StringPainter
    extends java.lang.Object
    Provides utility methods to draw strings.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void computeOptimalSize​(java.lang.String string, ej.microui.display.Font font, ej.mwt.util.Size size)
      Computes the optimal size of a string.
      static void drawStringAtPoint​(ej.microui.display.GraphicsContext g, java.lang.String string, ej.microui.display.Font font, int anchorX, int anchorY, int horizontalAlignment, int verticalAlignment)
      Draws a string aligned with an anchor point.
      static void drawStringInArea​(ej.microui.display.GraphicsContext g, java.lang.String string, ej.microui.display.Font font, int x, int y, int width, int height, int horizontalAlignment, int verticalAlignment)
      Draws a string aligned in a area.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Method Detail

      • computeOptimalSize

        public static void computeOptimalSize​(java.lang.String string,
                                              ej.microui.display.Font font,
                                              ej.mwt.util.Size size)
        Computes the optimal size of a string.

        The given size is modified to set the optimal size.

        Parameters:
        string - the string.
        font - the font.
        size - the size to modify.
      • drawStringInArea

        public static void drawStringInArea​(ej.microui.display.GraphicsContext g,
                                            java.lang.String string,
                                            ej.microui.display.Font font,
                                            int x,
                                            int y,
                                            int width,
                                            int height,
                                            int horizontalAlignment,
                                            int verticalAlignment)
        Draws a string aligned in a area.
        Parameters:
        g - the graphics context.
        string - the string.
        font - the font.
        x - the area x coordinate.
        y - the area y coordinate.
        width - the area width.
        height - the area height.
        horizontalAlignment - the horizontal alignment.
        verticalAlignment - the vertical alignment.
      • drawStringAtPoint

        public static void drawStringAtPoint​(ej.microui.display.GraphicsContext g,
                                             java.lang.String string,
                                             ej.microui.display.Font font,
                                             int anchorX,
                                             int anchorY,
                                             int horizontalAlignment,
                                             int verticalAlignment)
        Draws a string aligned with an anchor point.
        Parameters:
        g - the graphics context.
        string - the string.
        font - the font.
        anchorX - the anchor point x coordinate.
        anchorY - the anchor point y coordinate.
        horizontalAlignment - the horizontal alignment.
        verticalAlignment - the vertical alignment.