Package ch.swingfx.text
Class TextUtil
java.lang.Object
ch.swingfx.text.TextUtil
Utility class to work with text
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic intcalculatePreferredHeight(FontMetrics fm, int maxWidth, String text) This method calculates the preferred height for a rectangle that has a width ofmaxWidthand should display the Stringtextinside it with line breaks
-
Constructor Details
-
TextUtil
private TextUtil()
-
-
Method Details
-
calculatePreferredHeight
This method calculates the preferred height for a rectangle that has a width ofmaxWidthand should display the Stringtextinside it with line breaks- Parameters:
fm-FontMetricsto usemaxWidth- the maximum width of the rectangletext- the text we want to display- Returns:
- the preferred height
-