I want to be able to assign a hover color via CSS to a SplitPane Divider in JavaFX.
I am able to achive this by using the following CSS
.split-pane:horizontal > .split-pane-divider {
-fx-background-color: transparent;
}
.split-pane:horizontal > .split-pane-divider:hover {
-fx-background-color: lightblue;
}
However: since the divider is lagging behind the cursor, it causes a flickering effect, since the hover is triggered whenever the divider catches up to the cursor position - but while dragging slowly, it's just a lot of flickering.
I want the hover color to be applied throughout any dragging of the divider.
Is there a way to achieve this via CSS? I tried .split-pane-divider:focused
and .split-pane-divider:selected
, but no luck :(
If not, is there any other way to achieve this?
Thanks!
The solution of Sai Dandem works, but the solution due to the comment of James_D makes it quite a bit simpler. Thanks to both of you!
For a general split-pane:
.split-pane > .split-pane-divider {
-fx-background-color: transparent;
}
.split-pane > .split-pane-divider:hover,
.split-pane > .split-pane-divider:pressed {
-fx-background-color: lightblue;
}