S
S
Sergey Berezovsky2018-01-18 06:04:00
User interface
Sergey Berezovsky, 2018-01-18 06:04:00

How to find the height of a container in JavaFX?

How to find the height of the container anchorPane 2 if only ComboBox was passed to the method? In the picture, I described my actions, but at the end I come to a dead end ... Maybe there is some other way to find out its height?
5a600e6d393bc002111165.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Alexandrov, 2018-01-18
@SergeyBerezovsky

In javafx, all nodes have a generic setUserData(object) and getUserData() method. Here is the easiest way to do something like combobox.setUserData(anchorPane2.getHeight() ) and then directly in the method itself where only the combobox is passed to get it getUserData().
Another option is to move along your path, as I understand it, mainParrent is the root of the window, so to speak, then you get the nodes in it, pull out the scrollPane from there, get the nodes from the scrollPane and take the anchorPane2 in it, get the desired property from the anchorPane2.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question