[*不*聚焦时,删除JavaFX ScrollPane滚动条周围的边框

问题描述 投票:3回答:1

我有一个奇怪的问题。我已经使用CSS在JavaFX中为ScrollPane的滚动条设置了样式,但是现在每次ScrollPane为in focus时,边框都会消失。但是,如果单击窗格外部的按钮,它将返回。这是图像:未聚焦Unfocused关注的Focused这是CSS:

.scroll-bar:horizontal .track,
.scroll-bar:vertical .track{
    -fx-background-color :transparent;
    -fx-border-color :transparent;
    -fx-background-radius : 2.0em;
}

.scroll-bar:horizontal .increment-button ,
.scroll-bar:horizontal .decrement-button {
    -fx-background-color :transparent;
    -fx-background-radius : 0.0em;
    -fx-padding :0.0 0.0 10.0 0.0;

}

.scroll-bar:vertical .track-background,
.scroll-bar:horizontal .track-background {
   -fx-background-color: transparent;
   -fx-background-insets: 0;
   -fx-background-radius: 2em;
}

.scroll-bar:vertical .increment-button ,
.scroll-bar:vertical .decrement-button {
    -fx-background-color :transparent;
    -fx-background-radius : 0.0em;
    -fx-padding :0.0 10.0 0.0 0.0;

}

.scroll-bar .increment-arrow,
.scroll-bar .decrement-arrow{
    -fx-shape : " ";
    -fx-padding :0.15em 0.0;
}

.scroll-bar:vertical .increment-arrow,
.scroll-bar:vertical .decrement-arrow{
    -fx-shape : " ";
    -fx-padding :0.0 0.15em;
}

.scroll-bar:horizontal .thumb,
.scroll-bar:vertical .thumb {
    -fx-background-color : #dddddd;
    -fx-background-insets : 2.0, 0.0, 0.0;
    -fx-background-radius : 2.0em;
}

.scroll-bar:horizontal .thumb:hover,
.scroll-bar:vertical .thumb:hover {
    -fx-background-color : #9e9e9e;
    -fx-background-insets : 2.0, 0.0, 0.0;
    -fx-background-radius : 2.0em;
}

.scroll-bar{
   -fx-background-color: transparent;
   -fx-background-radius: 2em;
   -fx-focus-color: transparent;
   -fx-faint-focus-color: transparent;
}

.scroll-bar:vertical:focused {
   -fx-background-color: transparent;
}
css javafx
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.