不知道现在还用的上不?fireTableStructureChangedpublic void fireTableStructureChanged()    Notifies all listeners that the table's structure has changed. The number of columns in the table, and the names and types of the new columns may be different from the previous state. If the JTable receives this event and its autoCreateColumnsFromModel flag is set it discards any table columns that it had and reallocates default columns in the order they appear in the model. This is the same as calling setModel(TableModel) on the JTable.

解决方案 »

  1.   

    每次添加都要删除table,不能在tablemodel上改嘛!!!!看着不爽呀!
      

  2.   

    你的模型应该是继承自AbstractTableModel,数据改变时,要调用fireTableDataChanged()方法,视图才会刷新,如果模型继承自DefaultTreeModel,会自动刷新。数据库操作的话,用jb来的组件就可以了,很方便,不过,介绍这方面的书籍,我却很少看到,有一些电子书,举的例子都看不懂,讲的也不详细。JTable是典型的MVC模式,视图(不存储数据,只负责向模型查询)和模型(实际存储数据的地方)是独立工作的,要牢记这点,问题就解决了
      

  3.   

    要在tableModel里面添加和删除数据