-
Notifications
You must be signed in to change notification settings - Fork 104
SizeBindingBuilder
Manuel Mauky edited this page Jul 6, 2015
·
4 revisions
de.saxsys.mvvmfx.utils.sizebinding.SizeBindingBuilder
We often had the case, that an element should have the same size or at least the width of another element. You would have to do it on this way:
ScrollPane a = new ScrollPane();
VBox b = new VBox();
a.minWidthProperty().bind(b.widthProperty());
a.minheightProperty().bind(b.heightProperty());
a.maxWidthProperty().bind(b.widthProperty());
a.maxheightProperty().bind(b.heightProperty());
With the SizeBindingBuilder class you can do things like:
SizeBindingBuilder.bindSize().from(a).to(b);
SizeBindingBuilder.unbindSize().of(b);
SizeBindingsBuilder.bindWidth().from(b).to(a);
SizeBindingsBuilder.bindHeight().from(a).to(b);
With the fluent-api you can bind and unbind the size
or only the height
/width
of two components to each other.