Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX 2 TableView header font color

How can I change the text color of the TableView component's header?

I tired this:

.table-view .column-header, .table-view .filler {
    -fx-text-fill: white;
    -fx-border-width: 0, 0;
    -fx-font-size: 12px;
}

This remove the border, and also change the font size, but not the font color.

like image 635
Lakatos Gyula Avatar asked Dec 30 '12 12:12

Lakatos Gyula


2 Answers

Something like this might work.

.table-view .column-header .label {
    -fx-text-fill: white;
    -fx-font-weight: bold;
}
like image 197
ytw Avatar answered Oct 31 '22 19:10

ytw


@David Charles: style classes of the TableColumn also apply to the column header, so to style an individual column header, you can use

.table-view .column-header.foo .label {
    -fx-text-fill: white;
    -fx-font-weight: bold;
}

and in Java

tableColumn.getStyleClass().add("foo");
like image 41
warakawa Avatar answered Oct 31 '22 18:10

warakawa