Node and prefWidthProperty
Alexander.Kouznetsov at oracle.com
Thu Feb 21 13:32:15 PST 2013
You may want to comment on the corresponding issue in JIRA:
It also has a proposed workaround/fix.
On 2/11/13 9:09 AM, Sven Reimers wrote:
> Yes, I probably want to know about all the changes of width / height (bind
> to them).
> I can do a check if my Node is a Region and use the properties there, but I
> thought it would be more consistent if those were available straight from
> On Mon, Feb 11, 2013 at 4:42 PM, Richard Bair <richard.bair at oracle.com>wrote:
>> Yes! In fact there is no prefWidth property on Node (no getPrefWidth,
>> setPrefWidth, or prefWidthProperty). Rather the prefWidth() method is a
>> computational method vs. an accessor.
>> If you look at Region, you will find prefWidthProperty(), getPrefWidth(),
>> and setPrefWidth (along with min width, max width, min height, max height,
>> The prefWidth() method will inspect the prefWidth property, minWidth
>> property, maxWidth property etc and compute what the pref width for this
>> node is at this time.
>> Now, perhaps the question could be, why don't we have a computedPrefWidth
>> property on node? I suspect it has to do with two things. First, the
>> bindings associated with such a thing on a layout container would be pretty
>> intense. That's not necessarily saying it couldn't be done ("its all
>> software" as Hans Muller used to say -- we can do anything -- for a price).
>> However I expect it would be difficult. The second reason is because we
>> want to make it easy for subclasses to override the computation of the
>> prefWidth (as each layout container for example have their own algorithm
>> for figuring this out). As such, having method to override is much simpler
>> than binding that has to be broken and reestablished (although again, not
>> I'm guessing what you're wanting is a way to know when the pref size has
>> On Feb 10, 2013, at 9:58 AM, Sven Reimers <sven.reimers at gmail.com> wrote:
>>> Hi all,
>>> any special reason why there is not a prefWidthProperty on Node, although
>>> it has a prefWidth?
>>> Sven Reimers
>>> * Senior Expert Software Architect
>>> * NetBeans Dream Team Member: http://dreamteam.netbeans.org
>>> * Community Leader NetBeans: http://community.java.net/netbeans
>>> Desktop Java:
>>> * Duke's Choice Award Winner 2009
>>> * Blog: http://nbguru.blogspot.com
>>> * XING: https://www.xing.com/profile/Sven_Reimers8
>>> * LinkedIn: http://www.linkedin.com/in/svenreimers
>>> Join the NetBeans Groups:
>>> * XING: http://www.xing.com/group-20148.82db20
>>> * NUGM: http://haug-server.dyndns.org/display/NUGM/Home
>>> * LinkedIn: http://www.linkedin.com/groups?gid=1860468
>>> * Oracle: https://mix.oracle.com/groups/18497
More information about the openjfx-dev