In my Java Desktop Application I have a JavaFX Table with 3 columns. I want to set the font color of the 3rd column to red. I have not been able to set the font color of the Tableb at all. I looked into CSS and I did not find anything. Is there a way to do it with CSS? I also looked for setFont() with the hope of setting it that way. Nothing there. I could not even figure a way to set something on a certain cell.
TableView<TableData> myTable = new TableView<TableData>();
ObservableList<TableData> myTableData = FXCollections.observableArreyList(
new TableData("data", "data", "data"),
new TableData("data", "data", "data"));
TableColumn firstColumn = new TableColumn("First Column");
firstColumn.setProperty("one");
TableColumn secondColumn = new TableColumn("Second Column");
secondColumn .setProperty("two");
TableColumn thirdColumn = new TableColumn("Third Column");
thirdColumn .setProperty("three");
myTable.setItems(myTableData);
myTable.getColumns.addAll(firstColumn, secondColumn, thirdColumn);
How can I accomplish this? How can I set to font color? Any help will be appreciated.
You need to override the CellFactory.
Partial code just of the third column:
Entire Code Example: