当窗口调整大小时,如何避免SplitPane调整其中一个窗格的大小? [英] How can I avoid a SplitPane to resize one of the panes when the window resizes?
本文介绍了当窗口调整大小时,如何避免SplitPane调整其中一个窗格的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我只想用鼠标手动拖动拆分器来调整窗格的大小. 但是,当调整窗口大小时,我希望该窗格保留我选择的确切大小.允许另一个窗格自由更改大小.
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?
推荐答案
您应使用SplitPane.setResizableWithParent
静态方法.
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();
这篇关于当窗口调整大小时,如何避免SplitPane调整其中一个窗格的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文