Search code examples
javafxsplitpane

Split Pane divider change listener javafx


I have two split panes which both have a vertical split . I`m trying to add a listener between the two divider so that when i move one split pane the other will move .


Solution

  • Basically:

    SplitPane sp1 = ... ;
    SplitPane sp2 = ... ;
    
    // populate split panes...
    
    // now bind divider positions:  
    sp1.getDividers().get(0).positionProperty().bindBidirectional(
            sp2.getDividers().get(0).positionProperty());