tonimaroni
tonimaroni

Reputation: 1093

PopupView always shows a white rectangle as background

.popup-view {
    -fx-background-color: red; // nothing happens here
}
.popup-view .scroll-pane {
    -fx-background-color: green; // nothing happens here
}
.popup-view .viewport {
    -fx-background-color: violet; // color is shown
    -fx-border-color: violet;
    -fx-background-radius: 7; // no affect
    -fx-border-radius: 7;
}

enter image description here

if i remove .viewport it just shows a white background without radius.

i want a popup-view with a certain color and radius for that background - as violet for example. thanks for any help!

Upvotes: 0

Views: 166

Answers (1)

José Pereda
José Pereda

Reputation: 45476

If you check your PopupView control with ScenicView, you'll see that its ScrollPane has as style class root-node.

So your css should be something like this:

.popup-view > .root-node {
    -fx-background-color: green;
}

.popup-view > .root-node > .viewport {
    -fx-background-color: violet; 
    -fx-border-color: violet;
    -fx-background-radius: 7; 
    -fx-border-radius: 7;
}

Upvotes: 1

Related Questions