Javafx-2, delete focus highlighting through CSS
•
Java
I want to remove the blue border that overwrites the tableview when focusing
I checked Caspian CSS, for most components such as button and textfield, it performs the following operations:
.table-view:focused { -fx-background-color: -fx-focus-color,-fx-@R_585_2419@-border,-fx-control-inner-background; -fx-background-insets: -1.4,1; -fx-background-radius: 1.4,0; /*....*/ -fx-padding: 1; /* 0.083333em; */ }
My question is about CSS, and finally Can I override this pseudo class specification in the style sheet instead of trying to make the color transparent?
Solution
Yes, you can In the style sheet, use the JavaFX CSS attribute of your choice to define exactly the same CSS selector, as shown below:
.table-view:focused { -fx-background-color: red /* or transparent or other preferred color */,0; /*....*/ -fx-padding: 1; /* 0.083333em; */ }
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码