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 int
calculatePreferredHeight
(FontMetrics fm, int maxWidth, String text) This method calculates the preferred height for a rectangle that has a width ofmaxWidth
and should display the Stringtext
inside 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 ofmaxWidth
and should display the Stringtext
inside it with line breaks- Parameters:
fm
-FontMetrics
to usemaxWidth
- the maximum width of the rectangletext
- the text we want to display- Returns:
- the preferred height
-