I can't figure out how to listen for a "Divider Repositioned" event on a JavaFX 8 SplitPane. Here is a simple working Application that just needs the event listener added. Can someone help point me in the right direction?
public class TestCase extends Application {
public void start(Stage primaryStage) throws Exception {
Pane leftPane = new Pane();
Pane rightPane = new Pane();
SplitPane splitPane = new SplitPane(leftPane, rightPane);
// Need to create a listener that fires whenever the SplitPane's Divider is repositioned
// Within this listener I need access to the leftPane and rightPane so I can call requestLayout()
primaryStage.setScene(new Scene(splitPane));
primaryStage.setWidth(800);
primaryStage.setHeight(600);
primaryStage.show();
}
public static void main(String[] args) {
launch(args);
}
}
You can get the dividers with splitPane.getDividers()
and add ChangeListeners to the dividers.positionProperty()
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With