Velocity Reviews

Velocity Reviews (
-   Java (
-   -   Re: update JTable (

Daniele Futtorovic 07-17-2008 02:13 PM

Re: update JTable
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.

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.

to reply privately, change the top-level domain
in the FROM address from "invalid" to "net"

All times are GMT. The time now is 07:26 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.