wood burning stoves*
The moose likes JDBC and the fly likes Another DefaultTableModel post Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Another DefaultTableModel post" Watch "Another DefaultTableModel post" New topic

Another DefaultTableModel post

Przemek Wisniewski

Joined: Sep 28, 2009
Posts: 2
Hi Everybody,

I've got the MySQL "Database" with one table and just a few records in it. I am able to display all the records just fine using "select * from..". However, once displayed when i try to filter/search for something the from the table, I want only the relevant rows to be left/displayed in a table. I am also using the DefaultTableModel's insertRow() method. But it just appends the record in the first row. And it seems like there's no "clear()" method, so I tried to creat new(another) DefaultTableModel inside my search method in order to clear the previous (select * from..) but still no luck.. I have no idea why it won't work. I thought that when i setModel() again it should refresh display? What am I doing wrong?
Przemek Wisniewski

Joined: Sep 28, 2009
Posts: 2
Calling setRowCount(0) has solved the issue.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Another DefaultTableModel post
Similar Threads
Adding Column Dynamically to JTable
Prevent selection of certain JTable cells
How to change Jtable Total Rows in runtime ?
How do I access my field data?
regarding JTable