Am working on a project in swings and in that am adding rows to a JTable in a while loop.
My Scenario is this :-
As soon as the user clicks a button the program enters a while() loop and start adding rows to the DefaultTableModel of the Jtable one by one till the while loop terminates.
But the thing is that the table gets updated with the data only after the while loop has ended.I want it to update after adding each row and show it on the UI.
It would be really nice if someone could help me out with this provide a solution
I have already tried repaint() after adding each row but it didn’t work.
You need to run your operation in a seperate thread and then update the JTable in the gui thread. Something like this: