alt: color of scrollbar in popup menu

This commit is contained in:
huanghongxun
2020-04-23 12:10:25 +08:00
parent 886ebe6885
commit 9bda50f66e
2 changed files with 7 additions and 2 deletions

View File

@@ -38,6 +38,7 @@ public class PopupMenu extends Control {
private final BooleanProperty alwaysShowingVBar = new SimpleBooleanProperty(); private final BooleanProperty alwaysShowingVBar = new SimpleBooleanProperty();
public PopupMenu() { public PopupMenu() {
getStyleClass().add("popup-menu");
} }
public ObservableList<Node> getContent() { public ObservableList<Node> getContent() {
@@ -82,7 +83,7 @@ public class PopupMenu extends Control {
.otherwise(ScrollPane.ScrollBarPolicy.AS_NEEDED)); .otherwise(ScrollPane.ScrollBarPolicy.AS_NEEDED));
VBox content = new VBox(); VBox content = new VBox();
content.getStyleClass().add("menu"); content.getStyleClass().add("content");
Bindings.bindContent(content.getChildren(), PopupMenu.this.getContent()); Bindings.bindContent(content.getChildren(), PopupMenu.this.getContent());
scrollPane.setContent(content); scrollPane.setContent(content);

View File

@@ -106,7 +106,11 @@
-fx-padding: 8 16 8 16; -fx-padding: 8 16 8 16;
} }
.menu { .popup-menu .scroll-bar .thumb {
-fx-fill: rgba(0, 0, 0, 0.5);
}
.popup-menu .content {
-fx-padding: 4 0 4 0; -fx-padding: 4 0 4 0;
} }