JavaFX – disable row selection in tableview
•
Java
I have a read-only tableview in JavaFX 8. I don't want the user to select rows
Solution
After a while, I found out how to solve it, so I publish it here to future users
After adding the following lines to CSS, the selected lines will look exactly the same as the unselected lines, achieving the same effect I want in the same location:
.table-row-cell:filled:selected { -fx-background: -fx-control-inner-background ; -fx-background-color: -fx-table-cell-border-color,-fx-background ; -fx-background-insets: 0,0 0 1 0 ; -fx-table-cell-border-color: derive(-fx-color,5%); } .table-row-cell:odd:filled:selected { -fx-background: -fx-control-inner-background-alt ; }
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
二维码