N
N
nik1202952015-11-26 23:28:05
Java
nik120295, 2015-11-26 23:28:05

JavaFx resizing components (buttons/images) when window changes?

Good day to all, I recently started learning JavaFx, through the "javafx scene builder", and everything seems to be very clear and simple, but I ran into a problem.
How to resize components (images/buttons, etc.) when resizing a window?
I sat on this for a very long time and broke a lot of forums and sites, and did not find an answer.
Many thanks in advance to all for your response.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
Riard Brugekaaim, 2015-12-01
@OLDRihard

I will explain from my side: I will
not say about the setting directly in the code, but in SceneBuilder on the right there is a Layout section and a "sticking" graph: "Constraints module name". There you set the distance from each edge of the older panel. And no matter how you twirl the window, the module will always try to keep this distance from the edges, and stretch at random.

T
The_Educated_Fool, 2020-05-28
@The_Educated_Fool

root.layoutBoundsProperty().addListener(new ChangeListener() {
@Override
public void changed(ObservableValue<? extends Bounds> observableValue, Bounds bounds, Bounds t1) {
}
});
root is the panel that is directly contained in the scene
observableValue contains the root
bounds and t1 are the old and new sizes respectively

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question