Ah.

An example:

1. Have your table model backed by a List  - each entry is an object
containing data for an entire row. So - 6 elements in the collection, 6 rows
in the table.

2. Have a setData(List) method, which calls fireTableDataChanged.

3. Have a constructor which has a List argument - this should be passed to
setData(List)

4. Your implementation of getValueAt(int,int) should grab row data from your
list, then return data corresponding to the desired column.

I recommend Geary's "Graphic Java" volumes.

-----Original Message-----
From: steve jenson <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Wednesday, July 04, 2001 06:25
Subject: Re: TableDataModel question.


>
>Quoting Greg Munt ([EMAIL PROTECTED]):
>
>> I know of no swing class named AbstractTableDataModel, and
>
>I'm sorry, AbstractTableModel, you're correct.
>
>> javax.swing.table.AbstractTableModel has only one add method..
>
>sure, and when you extend AbstractTableModel there's nothing to
>keep you from overloading the add() method and adding other methods.
>
>thanks,
>steve
>
>> Frankly, I'm a bit confused.
>>
>> -----Original Message-----
>> From: steve jenson <[EMAIL PROTECTED]>
>> To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
>> Date: Wednesday, July 04, 2001 03:44
>> Subject: TableDataModel question.
>>
>>
>> >Hi everybody,
>> >
>> >In my Swing experience so far (about a month of intense reading and
>> >experimenting), I've noticed that one of the poorest things documented
>> >is getting a JTable to auto-update itself via a class extending
>> >the AbstractTableDataModel. Every example I've seen shows your new
>> >TableDataModel class having a gaggle of add() methods that take a
variety
>> >of the input you want your rows to be updated with but so far I haven't
>> >seen how you pass anything into your TableDataModel via a constructor
>> >and I haven't seen any of the add methods explicityly called.
>> >
>> >I was hoping maybe one of you Swing gurus could point me to someplace
>> >I haven't read or maybe somebody would mind explaining to me the
>> >magical magic that occurs inside a JTable that isn't obvious to me. :-(
>> >
>> >I'd really appreciate it.
>> >
>> >
>> >thanks a ton!
>> >steve
>> >
>> >
>> >--
>> >steve jenson <[EMAIL PROTECTED]> http://sieve.net/
>> >PGP fingerprint: 79D0 4836 11E4 A43A 0179  FC97 3AE2 008E 1E57 6138
>> >_______________________________________________
>> >Swing mailing list
>> >[EMAIL PROTECTED]
>> >http://eos.dk/mailman/listinfo/swing
>>
>> _______________________________________________
>> Swing mailing list
>> [EMAIL PROTECTED]
>> http://eos.dk/mailman/listinfo/swing
>
>--
>steve jenson <[EMAIL PROTECTED]> http://sieve.net/
>PGP fingerprint: 79D0 4836 11E4 A43A 0179  FC97 3AE2 008E 1E57 6138
>
>_______________________________________________
>Swing mailing list
>[EMAIL PROTECTED]
>http://eos.dk/mailman/listinfo/swing

_______________________________________________
Swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/swing

Reply via email to