How to update TableView Row using javaFx

后端 未结 1 1197
孤街浪徒
孤街浪徒 2021-01-14 02:50

I\'m trying to make some downloads and show the progress inside my table:

\"enter

相关标签:
1条回答
  • 2021-01-14 03:25

    You shouldn't need to add/remove the row to get the table to update when the progress value changes.

    The problem is that you're not making the progress property accessible to the TableView. This causes the progress.setCellValueFactory(...) call to wrap your getProgress() value in a new ObservableObjectWrapper. This allows the value to display in the TableView, but it won't notify the table when the value is changed.

    Add the following to your DownloadDataTable class, and your table will update when the value changes:

    public SimpleDoubleProperty progressProperty() {
        return this.progress;
    }
    
    public SimpleStringProperty typeProperty() {
        return this.type;
    }
    
    public SimpleStringProperty statusProperty() {
        return this.status;
    }
    
    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题