当前位置: 动力学知识库 > 问答 > 编程问答 >

swing - Refresh a bound JTable

问题描述:

I have JTable bound to an ObservableList named 'categories', this is master table. Another (detail) table is bound to master table with the expression 'selectedElement.materialsList', this detail table gets refreshed perfectly when selection is changed on the master table. I try to insert new rows in the detail table as:

int index = masterTable.getSelectedRow();

Categories category = categories.get(index);

Materials material = new Materials();

category.getMaterialsList.add(material);

My problem is that the detail table is not getting refreshed when I add new rows or update existing rows in its corresponing list. However, it works perfectly when I remove rows as:

category.getMaterialsList().remove(x);

Is there something that I am missing? I have also tried calling firePropertyChange as:

firePropertyChange('categories',null,category);

but problem is still there. Please guide me is there is something special that I need to take care of. Thanks in advance.

分享给朋友:
您可能感兴趣的文章:
随机阅读: