Jorge -

If you haven't already, you might want to check out the Java Tutorial:

http://java.sun.com/docs/books/tutorial/uiswing/components/table.html

You would definitely need three different table model objects, but you might
be able to write a single model class and create three instances of it.  You
might have some kind of filter parameter in the model that determines which
of the three behaviors to use.

The simplest way though, I think, would be to create separate data arrays
for the three tables, and use the DefaultTableModel class for all three
models.  This would result in duplication of data, though, and may not be
ideal

I'm assuming here that you don't need the table to be editable (so that the
user could modify the data, not just view it).  If you need the user to be
able to modify the data, then you do need for all three models to share the
same data source.  In that case, DefaultTableModels would not work well.

- Keith


> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On
> Behalf Of Jorge Morales
> Sent: Monday, October 22, 2001 10:29 PM
> To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
> Subject: 3 JTables displaying almost the same data
>
>
> Hi all,
>   I am doing a Swing application which uses 3 JTables to display almost
>   the same data. The thing is I have some data that I want to
> display in the
>   first table, in the second table I want to display some of this
> data matching
>   some criteria, and in the third the data that do not math these
> criteria.
>   I load the data initially from a file. The problem is that I am not
>   very well versed with the MVC architecture, and I am not sure if I
>   should use one model or three different models, and how to do it.
>
>   If someone can throw some light on me would be very
> appreciatted. Also can
>   somebody recommend me any reading on the MVC architecture that
> a newbie can
>   understand?
>   Thank you very much.
>
>
>
> --
> Jorge
> [EMAIL PROTECTED]
>
> _______________________________________________
> Advanced-swing mailing list
> [EMAIL PROTECTED]
> http://eos.dk/mailman/listinfo/advanced-swing
>

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

Reply via email to