Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
820 views
in Technique[技术] by (71.8m points)

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

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?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...