Search code examples
javafxprogress

Javafx add text to a progress bar inside a table


I've been working with javafx tables and managed to add a Table Column with progress bars using progressBarColumn.setCellFactory(ProgressBarTableCell.forTableColumn());, it uses a dummy Person class to get its data not javafx.concurrent.Task.

All works well but i was wondering if you could also add text to the progress bars in the table, sort of like swings JProgressBar setString(String string).

I'm rather noobish with javafx so i don't know much about it.


Solution

  • You cannot do it using ProgressBarTableCell. You need to use a custom Control for it.

    You can use the custom control, ProgressIndicatorBar, created by JewelSea and add it to your progressBarColumn.

    For more information on how to add Controls to TableColumn, you can check this answer

    JavaFX: Add UI control to TreeTableView

    It adds it to a TreeTableView, but you can apply the same logic for TableView as well.