JavaFX:隐藏SplitPane的滑块/分隔线

use*_*481 11 javafx slider splitpanel

我有一个JavaFX应用程序SplitPane.我想隐藏滑块/分隔线SplitPane.我怎样才能做到这一点?

来自德国的问候(对不起我的英语)

朱利安

Joe*_*oel 14

它与Java FX8(摩德纳风格)略有不同:

.split-pane *.split-pane-divider {
    -fx-padding: 0 1 0 1;
}
Run Code Online (Sandbox Code Playgroud)

  • `-fx-padding:1 0 1 0`垂直方向+1 (2认同)

Ram*_*zan 7

在caspian.css中,您将看到

/* horizontal the two nodes are placed to the left/right of each other. */
.split-pane:horizontal > * > .split-pane-divider {
   -fx-border-color: transparent -fx-box-border transparent #BBBBBB;
   -fx-background-color: transparent, -fx-inner-border-horizontal;
   -fx-background-insets: 0, 0 1 0 1;
}

/* vertical the two nodes are placed on top of each other. */
.split-pane:vertical > * > .split-pane-divider {
   -fx-border-color:  #BBBBBB transparent -fx-box-border transparent;
   -fx-background-color: transparent, -fx-inner-border;
   -fx-background-insets: 0, 1 0 1 0;
}
Run Code Online (Sandbox Code Playgroud)

我使用的是垂直的,所以我在我的css中覆盖了垂直方向,如下所示:

.split-pane:vertical > * > .split-pane-divider {
   -fx-border-color:  transparent;
   -fx-background-color: transparent;
   -fx-background-insets: 0;
}
Run Code Online (Sandbox Code Playgroud)

它有效.如果你也想隐藏抓取器(例如我没有隐藏它,看起来很好),我认为以下规则可能会起作用:

.split-pane *.vertical-grabber {
    -fx-padding: 0;
    -fx-background-color: transparent;
    -fx-background-insets: 0;
    -fx-shape: " ";
}
Run Code Online (Sandbox Code Playgroud)

我希望它有所帮助.


mat*_*ala -1

SplitPane.Divider不继承自Node,因此它没有disableProperty.

如果您需要仅通过代码调整分割窗格的大小,则可以通过 CSS 将分隔线设置为不可见且大小接近 0。

否则使用AnchorPane's 嵌套到 aVBox