Documentation of 'org.jfree.chart.util.TextUtils' Java class
TextUtils
org.jfree.chart.util

Class TextUtils



  • public class TextUtils
    extends java.lang.Object
    Text utility functions.
    Since:
    1.0.18
    • Constructor Summary

      Constructors 
      Constructor and Description
      TextUtils() 
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static java.awt.geom.Rectangle2D calcAlignedStringBounds(java.lang.String text, java.awt.Graphics2D g2, float x, float y, org.jfree.ui.TextAnchor anchor)
      Returns the bounds of an aligned string.
      static java.awt.geom.Rectangle2D drawAlignedString(java.lang.String text, java.awt.Graphics2D g2, float x, float y, org.jfree.ui.TextAnchor anchor)
      Draws a string such that the specified anchor point is aligned to the given (x, y) location, and returns a bounding rectangle for the text.
      static java.awt.geom.Rectangle2D getTextBounds(java.lang.String text, double x, double y, java.awt.FontMetrics fm)
      Returns the bounds for the specified text when it is drawn with the left-baseline aligned to the point (x, y).
      static java.awt.geom.Rectangle2D getTextBounds(java.lang.String text, java.awt.FontMetrics fm)
      Returns the bounds for the specified text.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TextUtils

        public TextUtils()
    • Method Detail

      • drawAlignedString

        public static java.awt.geom.Rectangle2D drawAlignedString(java.lang.String text,
                                                                  java.awt.Graphics2D g2,
                                                                  float x,
                                                                  float y,
                                                                  org.jfree.ui.TextAnchor anchor)
        Draws a string such that the specified anchor point is aligned to the given (x, y) location, and returns a bounding rectangle for the text.
        Parameters:
        text - the text.
        g2 - the graphics device.
        x - the x coordinate (Java 2D).
        y - the y coordinate (Java 2D).
        anchor - the anchor location.
        Returns:
        The text bounds (adjusted for the text position).
      • calcAlignedStringBounds

        public static java.awt.geom.Rectangle2D calcAlignedStringBounds(java.lang.String text,
                                                                        java.awt.Graphics2D g2,
                                                                        float x,
                                                                        float y,
                                                                        org.jfree.ui.TextAnchor anchor)
        Returns the bounds of an aligned string.
        Parameters:
        text - the string (null not permitted).
        g2 - the graphics target (null not permitted).
        x - the x-coordinate.
        y - the y-coordinate.
        anchor - the anchor point that will be aligned to (x, y) (null not permitted).
        Returns:
        The text bounds (never null).
        Since:
        1.3
      • getTextBounds

        public static java.awt.geom.Rectangle2D getTextBounds(java.lang.String text,
                                                              java.awt.FontMetrics fm)
        Returns the bounds for the specified text. The supplied text is assumed to be on a single line (no carriage return or newline characters).
        Parameters:
        text - the text (null not permitted).
        fm - the font metrics (null not permitted).
        Returns:
        The text bounds.
      • getTextBounds

        public static java.awt.geom.Rectangle2D getTextBounds(java.lang.String text,
                                                              double x,
                                                              double y,
                                                              java.awt.FontMetrics fm)
        Returns the bounds for the specified text when it is drawn with the left-baseline aligned to the point (x, y).
        Parameters:
        text - the text (null not permitted).
        x - the x-coordinate.
        y - the y-coordinate.
        fm - the font metrics (null not permitted).
        Returns:
        The bounding rectangle (never null).

DMelt 3.0 © DataMelt by jWork.ORG

You see the box below because you did not login.