26

I want to resize the pane only manually dragging the splitter with the mouse. But when the window is resized, I would like that pane to keep the exact size that I chose. Allowing the other pane to change size freely.

Do you think of any way to accomplish this?

betaman
  • 1,865
  • 5
  • 25
  • 30

1 Answers1

51

You should use SplitPane.setResizableWithParent static method.

        SplitPane root = new SplitPane();

        final Pane paneFixed = new StackPane();
        paneFixed.getChildren().add(new Text("fixed"));

        SplitPane.setResizableWithParent(paneFixed, Boolean.FALSE);

        Pane paneFree = new StackPane();
        paneFree.getChildren().add(new Text("free"));

        root.getItems().addAll(paneFree, paneFixed);

        stage.setScene(new Scene(root, 300, 200));
        stage.show();
Sergey Grinev
  • 34,078
  • 10
  • 128
  • 141
  • 13
    Answered my own question. Yes, you can set this in FXML: `SplitPane.resizableWithParent="false"` on the child control. – crush Feb 19 '14 at 16:30
  • I had problems with SplitPane when window was resizing , `SplitPane.setResizableWithParent(node, Boolean.FALSE);` solved them !! – GOXR3PLUS Sep 17 '17 at 20:34