Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to center text inside a ListView?

Is there any way to align text of elements to center inside a ListView in javafx?

I haven't found a method that does this.

like image 881
Kidades Avatar asked Dec 20 '15 23:12

Kidades


1 Answers

You could use a css stylesheet to set the style alignment of ListCells of a ListView. E.g. if the id lv is assigned to the ListView:

#lv .list-cell {
    -fx-alignment: center;
}
like image 145
fabian Avatar answered Oct 12 '22 14:10

fabian