@@ -240,6 +240,7 @@ protected double computePrefWidth(double ignoredHeight) {
240240 @ Override
241241 protected double computePrefHeight (double width ) {
242242 if ( isFolded .getValue () ) return 0.0 ;
243+ if ( ! wrapText .get () ) width = Double .MAX_VALUE ;
243244 Insets insets = getInsets ();
244245 double overhead = getGraphicPrefWidth () + insets .getLeft () + insets .getRight ();
245246 return text .prefHeight (width - overhead ) + insets .getTop () + insets .getBottom () + text .getLineSpacing ();
@@ -248,12 +249,17 @@ protected double computePrefHeight(double width) {
248249 @ Override
249250 protected void layoutChildren () {
250251 Insets ins = getInsets ();
251- double w = getWidth () - ins .getLeft () - ins .getRight ();
252252 double h = getHeight () - ins .getTop () - ins .getBottom ();
253253 double graphicWidth = getGraphicPrefWidth ();
254- double half = text .getLineSpacing () / 2.0 ;
255254
256- text .resizeRelocate (graphicWidth + ins .getLeft (), ins .getTop () + half , w - graphicWidth , h - half );
255+ if ( wrapText .get () ) {
256+ double half = text .getLineSpacing () / 2.0 ;
257+ double w = getWidth () - ins .getLeft () - ins .getRight ();
258+ text .resizeRelocate (graphicWidth + ins .getLeft (), ins .getTop () + half , w - graphicWidth , h - half );
259+ } else {
260+ text .relocate ( graphicWidth + ins .getLeft (), ins .getTop () );
261+ text .autosize ();
262+ }
257263
258264 graphic .filter ( Node ::isManaged ).ifPresent (
259265 g -> g .resizeRelocate (graphicOffset .get () + ins .getLeft (), ins .getTop (), graphicWidth , h )
0 commit comments