January 16, 2019 11:31 PM, "Ty Young" <youngty1...@gmail.com> wrote:

> How else is percentage based UI sizing besides DoubleBinding(s)? Isn't column 
> restraints just the
> same thing but aligns everything to a column?
>
> I have to ask(again) as to why minWidth/maxWidth, minHeight/maxHeight, 
> prefWidth/prefHeight aren't
> read only if this is going to be an *always* realistically going to be an 
> issue.

Column constraints don't use any bindings, neither do any other layout panes.
{min,pref,max} width/height are merely hints for a parent to layout the child. 
They are not the final authority on child size. The actual final size of a 
child is set by calling Node#resize on it, which is what the parent does during 
the Parent#layoutChildren call. During this call the parent knows about its own 
size and can split that space among the children.
A rogue parent could completely ignore these hints and resize the child to 
whatever it wants.

On your second point, it is only an issue if you use it in the wrong way, 
without understanding.
You bound the minWidth of a scrollpane's content to 85% of the scrollpane's 
widthProperty (which is actual width).
When you resize the scrollpane to <85% of its original size, its content still 
has the old minWidth property which is greater than the current width of the 
scroll pane. So the scrollpane shows horizontal bar. This is not a bug. 
widthProperty is supposed to be valid after layout.

Use bindings for size if you want to do some advanced sizing. Like size 
matching unrelated nodes with different parents to get some visual effect. You 
could create a custom textarea that binds minWidth to the number of characters 
in the first line.
I have never had a use case but someone else might.
Use it for cases where there is no mutual dependency or "race condition".

>> I saw your code and I can confirm this is the main cause.
>> If you want a 15-85 % split, you should have used a GridPane with two 
>> columns with the given
>> percentage constraints.
> 
> This works for the buttons/scrollpane but what about the subcontent? 
> TableView's scrollbars also
> glitch out in the exact same way.

Set scrollpane to fit to width. Add a gridpane with a single column whose 
column width is set to 85%. Set gridpane alignment to center. Drop the bindings 
and your problems will be solved.

> SceneBuilder's lack of UI snapping compared to Netbean's Swing builder makes 
> it incredibly
> difficult to get anything remotely pixel perfect without banging your head 
> against a wall. Separate
> controller classes and FXML annotations everywhere isn't really desirable 
> either. I originally
> entertained the idea of doing it all in FXML only to quickly discard the idea.

If you are talking about snapping like in aligning to other UI elements, then 
its there and you dont need it with the rought layout. If you mean snapping to 
pixels, JavaFX has it inbuilt and on by default.

Regards
Siddhesh

Reply via email to