Class TextUtil

java.lang.Object
ch.swingfx.text.TextUtil

public final class TextUtil extends Object
Utility class to work with text
  • Constructor Details

    • TextUtil

      private TextUtil()
  • Method Details

    • calculatePreferredHeight

      public static int calculatePreferredHeight(FontMetrics fm, int maxWidth, 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