dcsimg
AbstractTableModel
2 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Gonk_Gonzalez
Posted On:   Thursday, July 21, 2005 07:49 PM

I'm new to java so please forgive any confusion with terminology etc, I'm currently sourcing a good reference text to use. Basically I've got an AbstractTableModel class (MyTableModel) that creates a table model. To create the table model its constructor is fed a resultset (and table name not currently needed for my purposes) from another class thus //Define the table model variable public MyTableMode aTblModel; //Instantiate the table model object aTblModel = new MyTableModel(rsResultSet,"TableName"); Everything works OK so far with one table. What I'm trying to do is to use this same AbstractModelClass (why write more code) to provide table models for more tha   More>>

I'm new to java so please forgive any confusion with terminology etc, I'm currently sourcing a good reference text to use.
Basically I've got an AbstractTableModel class (MyTableModel) that creates a table model. To create the table model its constructor is fed a resultset (and table name not currently needed for my purposes) from another class thus


			
//Define the table model variable
public MyTableMode aTblModel;
//Instantiate the table model object
aTblModel = new MyTableModel(rsResultSet,"TableName");



Everything works OK so far with one table.
What I'm trying to do is to use this same AbstractModelClass (why write more code) to provide table models for more than one table (the ui allows the user to have concurrent access to multiple tables). Something like


			
aTblModel = new MyTableModel(rsResultSetA,"TableNameA") ;
bTblModel = new MyTableModel(rsResultSetB,"TableNameB") ;


However I'm obviously missing something cause both table model reference variables wind up holding info for rsResultSetB (or whichever is called last). I've tried various ways of setting the reference variables most work for one table but none establish two separate table models. I'm starting to wonder if I need to put each table model (aTblModel,bTblModel) into a vector or an array or something to differentiate them.

Any help is much appreciated, a nudge in the right direction at this point will save me much time - thanks.

   <<Less

Re: AbstractTableModel

Posted By:   Brian_Stempin  
Posted On:   Monday, July 25, 2005 10:56 PM

Post the MyTableModel code. I believe the reason may lie within that. Cheers

~BStempi

Re: AbstractTableModel

Posted By:   Almagest_FUTT  
Posted On:   Friday, July 22, 2005 06:38 AM

Since you say you're new to java, i may venture the presumption that you're declaring the Lvalue that holds your ResultSet within your "MyTableModel" class being static (which'd be a silly idea).
About | Sitemap | Contact