Lakatos Gyula
Lakatos Gyula

Reputation: 4160

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.

Upvotes: 6

Views: 23750

Answers (2)

warakawa
warakawa

Reputation: 610

@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");

Upvotes: 3

ytw
ytw

Reputation: 1355

Something like this might work.

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

Upvotes: 17

Related Questions