• Post Reply Bookmark Topic Watch Topic
  • New Topic

TableModel question  RSS feed

 
Matt Bucknam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have created a TableModel which extends AbstractTableModel. It works perfectly and returns all rows from the "database" to the table in the GUI. My question is how do I apply the search criteria that the user enters in the GUI to the TableModel. Maybe I wrote mine wrong but the TableModel instantiates its own DataClient. The TableModel doesn't have access to the filter variables in the GUI program does it?
Maybe it is a question of my poor design or understanding of how all this works?
 
Lisa Foster
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I pass the Data instance from the client to the tableModel
such as MyTable(Data tableInstance)
{
}
 
Matt Bucknam
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have to have an empty constructor for the table model so I did it this way:
In gui construct the new table model
call a method in table model, initialize(DataClient dc), which sets a class variable in the table model to the DataClient.
Does that sound like a good way?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!