• Post Reply Bookmark Topic Watch Topic
  • New Topic

TableModel question

 
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?
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!