JavaFX Modify Table View Header aligment on each column

2.4k Views Asked by At

how do i set an aligment regarding to each Colomn header on table view?

Example i have 2 Columns and i want to set the aligment from first column on center and as the second one on the left side.

I've already done the table content with, but can't move the header.

Changing all of the header aligment would be easy, but that is not what i want.

Here are my Table: i want the "projektdetail" set to the left:

enter image description here

Thanks in advance

Added: The answer to this: JavaFx how to align only one column-header in tableview?

I've tested the Java8 solution and it works

1

There are 1 best solutions below

2
On

You could give the column a custom class with:

tableView.getColumns().get(2).getStyleClass().add("my_class")

and then style it with css!

.column-header#my_class .label {
    -fx-alignment: LEFT;
}