ahmad faraz ahmad faraz - 2 months ago 33
Java Question

Change ListView font size in JavaFX

I want to know how can I change the list view items text font size in JavaFx. The size of each row text will vary . I tried using cell factor property but i don't know how to use it. Can anybody help me here ?

Answer

In javaFx you can use css to style different objects. It depends on the object in your list view but it would go something like this.

ListView<Hyperlink> listview = ..

            ObservableList<Hyperlink> lists = listview.getItems();

            for(Hyperlink link:lists)
            {
                link.setStyle("-fx-background-color:#ffffff");
            }
Comments