JavaFX ListView selection - how to delete the selection border


I have a javaFX ListView with a setCellFactory in order to customize the cells. The problem is that when I select a cell a blue border appear around the cell. Where is this border coming from ? I would like to change the background color of the cell instead of using a blue border.

enter image description here

10/7/2014 7:08:32 PM

Accepted Answer

The border is coming from the default stylesheet, modena.css; see lines 2233-2242 (in Java 8; in prior versions it was caspian.css). These borders are implemented by having nested background colors with varying insets.

To remove the border, try the following in an external stylesheet:

.list-cell:filled:selected {
  -fx-background-color: -fx-background ;
  -fx-background-insets: 0 ;
10/7/2014 7:28:35 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow