0

I have a Model that gets data from a database.The Model has a variable length which is the duration of the Model in seconds, however I would like to show this length variable in my TableView as a string that displays minutes, for example: 70 -> "1:10"

I currently have the following, it works but it shows the length as Integers

...
public TableView<Model> table;
public TableColumn<Model, Integer> length;
...
public void initialize() {
    ...
    length.setCellValueFactory(new PropertyValueFactory<>("length"));
    table.setItems(database.getAllModels())
}

I rather don't change anything to the Model as i just get an observableArrayList that I just put in my table. How can I easily modify this?

fangio
  • 1,746
  • 5
  • 28
  • 52
  • Can you adapt the answer to https://stackoverflow.com/questions/60746829/display-two-decimal-places-of-a-float-in-a-tableview-javafx ? – James_D Mar 19 '20 at 12:37
  • 2
    Does this answer your question? [display two decimal places of a float in a TableView JavaFx](https://stackoverflow.com/questions/60746829/display-two-decimal-places-of-a-float-in-a-tableview-javafx) – kleopatra Mar 19 '20 at 13:58

0 Answers0