TextFlow and Min vs. Pref size

Felipe Heidrich felipe.heidrich at oracle.com
Mon Dec 3 10:13:17 PST 2012


It was not an oversight but not something I play around all that much.

The behavior is described in the javadoc:
preferred size is ideal size where no line needs to wrap.
minimal size is the for padding, nothing more. When the width is between min size and pref size lines will wrap.
maximum size is unbounded.

I think the problem was I couldn't define minimal size any another way ? What else could it be, lines just wrap "a little bit" ?

In my tests when I made minimal equals to preferred what happened was that I could not longer resize the parent container so that lines would wrap.

I'm out of town this week but I'll do my best to try your snippet, please feel free to file a jira if you preferred. I'm more than glad helping out or even modifying the behavior.


On Dec 2, 2012, at 9:20 PM, Danno Ferrin wrote:

> I was playing with the TextFlow bits in the JDK8 ea and was wondering about
> the handling of min vs pref sizing.  The TextFlow can return some very
> small min sizes which are much smaller than the contained text elements.
> For example, I have a text with min/pref/max all of 269.85 x 30.62 while
> the min/pref/max of the parent TextFlow (which contains just the text node)
> of 0.0 x 17.2 / 269.85 x 48.62 / maxValuexmaxValue.  This is problematic
> when place in a scroll pane, as all the text flows tend to bunch up on each
> other.
> Is this a design intent or an oversight?
> For a workaround I've wrapped then TextFlows in panes that report minHeight
> as PrefHeight, so I don't see the bunching in scrollpane problem.
> For an interactive example of this behavior I have a toy app at bitbucket:
> https://bitbucket.org/shemnon/flowdown

More information about the openjfx-dev mailing list