How can I avoid a SplitPane to resize one of the panes when the window resizes?

前端 未结 1 1927
青春惊慌失措
青春惊慌失措 2020-12-14 16:58

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. A

相关标签:
1条回答
  • 2020-12-14 17:48

    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();
    
    0 讨论(0)
提交回复
热议问题