-1

I can't resolve this problem. I am trying to change blue table border when i clicking on the row o outside but i cant found the way to change the color.

/* TABLA*/
.table-view .column-header, .table-view .column-header-background .filler {
    -fx-cell-size: 20;
    -fx-background-color: #005c00;

    /*Colocar borde derecho mas claro*/
    -fx-border-color: #005c00 #b4ff9a #005c00 #005c00 ;
}
.table-view .column-header-background .label {
    -fx-text-fill: white;
    -fx-font-weight: bold;
    -fx-aligment: CENTER_LEFT;
}
.table-view .cell{
    -fx-cell-size: 30;
    -fx-aligment: center-left;
    -fx-text-fill: #000000;
    -fx-alignment: CENTER_LEFT;
}


.table-row-cell:selected{
    -fx-background-color: derive(#258d19, 50%);
}

.table-row-cell:selected .cell{
        -fx-border-color: transparent #b4ff9a transparent transparent;

}

.table-row-cell:selected .text{
    -fx-fill: white;   
}

Before select: before select the row

After Select: Table Problem CSS

And when I click outside a row a blue border is shown: enter image description here

I tryed to write

-fx-background-color: #005c00; 

in all selector but it doesn't work.

I looked for the same problem but not found nothing. Sorry

MiguelDAD
  • 3
  • 3
  • 1
    Are you referring to the [blue focus ring](https://stackoverflow.com/questions/6092500/how-do-i-remove-the-default-border-glow-of-a-javafx-button-when-selected) for the entire table? If so, what do you want to do with it? – jewelsea Jan 17 '23 at 23:33
  • @jewelsea I want to remove it. – MiguelDAD Jan 18 '23 at 08:03
  • [mcve] please .. demonstrating what you are after and how it doesn't work as expected – kleopatra Jan 18 '23 at 14:13

1 Answers1

1

You can set the focus traversable flag on the table control upon initialization of your Controller:

table.setFocusTraversable(false);

Or simply make the focus color transparent using css:

table.setStyle("-fx-focus-color: transparent; -fx-faint-focus-color: transparent;");
Fuzail
  • 372
  • 5
  • 12
  • Thanks you, but when I click outside a row a blue border is shown [blue border in row](https://i.stack.imgur.com/q0VkY.png) – MiguelDAD Jan 18 '23 at 13:27
  • @MiguelDAD Your question was not clear, you only mentioned table border, not row border, hence the answer you received. – jewelsea Jan 18 '23 at 13:44
  • @MiguelDAD This is beyond the scope of the question and I am unable to reproduce the issue with the row on my end however I'd suggest you should try applying -fx-focus-color property of CSS for the table row this time. Like `.table-row-cell { -fx-focus-color: transparent; }` in a css file. If it doesn't work, then lookup table row styling in JavaFX. – Fuzail Jan 18 '23 at 15:25
  • @jewelsea I'm sorry, but since the man understands I ask him – MiguelDAD Jan 18 '23 at 18:19