Class TextUtil


  • public final class TextUtil
    extends java.lang.Object
    Utility class to work with text
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      private TextUtil()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int calculatePreferredHeight​(java.awt.FontMetrics fm, int maxWidth, java.lang.String text)
      This method calculates the preferred height for a rectangle that has a width of maxWidth and should display the String text inside it with line breaks
      • Methods inherited from class java.lang.Object

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

      • TextUtil

        private TextUtil()
    • Method Detail

      • calculatePreferredHeight

        public static int calculatePreferredHeight​(java.awt.FontMetrics fm,
                                                   int maxWidth,
                                                   java.lang.String text)
        This method calculates the preferred height for a rectangle that has a width of maxWidth and should display the String text inside it with line breaks
        Parameters:
        fm - FontMetrics to use
        maxWidth - the maximum width of the rectangle
        text - the text we want to display
        Returns:
        the preferred height