Studiosus
Studiosus

Reputation: 143

Javafx Splitpane divider positions on resizing the parent pane

I have a splitpane with three children, but I want to show just the 2 top or the 2 bottom children at a time. So I implement a sliding animation, which slide the splitpane in a parent pane up and down. The sliding animation works fine, but when I resize the parent pane I have a problem with the divider positions. How can I make sure, that the divider positions are always correct? The image should makes my idea clear. enter image description here

Upvotes: 1

Views: 1266

Answers (1)

Muten Roshi
Muten Roshi

Reputation: 513

Do you want to force the divider to always stay in the middle? You can use highlevel binding:

splitPane.getDividers().get(0).positionProperty()
            .bind(splitPane.heightProperty().divide(2));

Hope this helps.

Upvotes: 1

Related Questions