如何不让百度收录网站,wordpress主题the7.6,js代码下载网站,个旧云锡建设集团网站I have searched on stackoverflow and a couple of people have said to use that method.不,您不应在TableModel本身的上下文之外调用任何fireTableXxx方法,否则人们会认为这完全是错误的,将来会给您带来麻烦.从代码的外观来看,什么都没有改变.如果您已根据上一个问题中提供的…I have searched on stackoverflow and a couple of people have said to use that method.不,您不应在TableModel本身的上下文之外调用任何fireTableXxx方法,否则人们会认为这完全是错误的,将来会给您带来麻烦.从代码的外观来看,什么都没有改变.如果您已根据上一个问题中提供的答案更新了TableModel,则该模型中的数据与外部源没有任何关系.您需要从外部源手动重新加载数据,创建新的TableModel并将其应用于表例如…JButton btnRefreshAllPlayers new JButton(Refresh);btnRefreshAllPlayers.addActionListener(new ActionListener() {public void actionPerformed(ActionEvent arg0) {TableModel model new PlayerTableModel(FileHandler.getCompletedPlayers());table.setModel(model);}});I have also tried setting a new model with the updated ArrayList and it worked but did not keep the table row widths I previously set.对于表来说这是合理的事情,因为它不知道新模型是否具有与旧模型相同的属性/列,因此将其重置.您可以遍历ColumnModel,在应用模型并重新应用宽度之前将列的宽度存储在List或Map中Is there a proper way to update the JTable?您可以为TableModel提供刷新方法,该方法可以加载数据本身并触发tableDataChanged事件public class PlayerTableModel extends AbstractTableModel {private final List summaries;public PlayerTableModel(List summaries) {this.summaries new ArrayList(summaries);}// Other TabelModel methods...public void refresh() {summaries new ArrayList(FileHandler.getCompletedPlayers());fireTableDataChanged();}}然后,您需要在ActionListener中调用此方法…PlayerTableModel model (PlayerTableModel)table.getMode();model.refresh();