I am creating a simple application using Swings . I am executing search on the database and result i have shown in table.

My first query resulted in 8 rows which was shown clearly.

Now on same frame i changed the search criteria and clicked search button. Now its resulting 3 rows but on Panel still previous result is show.

Can anyone help me on how to update the table. contents.

I have created a new table under the action event of button and added it there.....

First of, it is Swing, not Swings.

Second, you probably have not updated the container holding the table. Call validate(), and/or repaint() on the container.

Third, there is no reason to create a whole new table. Create a new TableModel and assign that TableModel to the existing table. Then call validate() and/or repaint() on the JTable.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.