What is the relationship between JTable, TableModeland TableData? If I just change TableData, it will also change the display of the data in the component JTable, or I have to call some method to synchronize the two. I looked through this one , but it clearly does not say or show me the relationship in terms of updates
JTable
TableModel
TableData
When you change the value in the TableModel data, you must fire this event. eg. changing the value of one cell, you call fireTableCellUpdated(row, col);.
fireTableCellUpdated(row, col);
See this one more specifically.
, "TableData", , JTable. , , TableModel , .
Model , , , , JTable , , . , JTable TableModel; TableModel JTable.
, , TableModel. , TableModel , ( , ..), TableModel JTable . , TableModel , (). TableModel .
TableModel JTable (TableModelListener), .
When changing data in the model, it is expected that the model will inform registered listeners by clicking TableModelEvent . The event itself may contain additional information about the details of the change (the structure has changed or only some cell data has changed) to allow JTable to perform an optimized view update.