On 2008-07-17 15:46 +0100,
allegedly wrote:
> I create AbstractTableModel model, then create table new
> JTable(model) and add some data.
> Then I want to add or delete some columns to data. How can I update
> this JTable?
Use a javax.swing.table.DefaultTableModel instead of the
AbstractTableModel. It's got methods to do what you want.
<http://java.sun.com/javase/6/docs/api/javax/swing/table/DefaultTableModel.html>
The JTable registers listeners with its data and columns models. Updates
to the visual representation are best achieved by making these listeners
be notified. DefaultTableModel does that for you -- as a rule, however,
I'd encourage using a dedicated TableModel for almost all non-trivial
solutions. This applies to the TableColumnModel only to a lesser extent,
inasmuch as changes to the column structure are less frequent than
changes to the row structure.
--
DF.
to reply privately, change the top-level domain
in the FROM address from "invalid" to "net"