How to center text inside a ListView?

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

I did not find a method that does this.

+4
source share
2 answers

You can use css stylesheet to set style alignment ListCellto ListView. For example. if id is lvassigned ListView:

#lv .list-cell {
    -fx-alignment: center;
}
+5
source

try downloading the font:

Font.loadFont (getClass (). GetResourceAsStream ("/ direct / font_nam .ttf"), 20);
0
source

Source: https://habr.com/ru/post/1621026/


All Articles