dshrenik
asked on
Update table contents periodically
I want to refresh my table periodically since its contents change from time to time.
Please let me know what's the best way to do this. Thanks!
Please let me know what's the best way to do this. Thanks!
You change table model contents and repaint your table
ASKER
I am not changing the contents explicitly.
I want my program to poll data (from a server, for example). This must happen periodically, say eveery 20s. Should I have a timer, or is there a better way?
I want my program to poll data (from a server, for example). This must happen periodically, say eveery 20s. Should I have a timer, or is there a better way?
while(true){
Thread.currentThread().sle ep(20000);
//get new data and update the model
jtable.repaint();
}
Thread.currentThread().sle
//get new data and update the model
jtable.repaint();
}
ASKER
This gets into the constructor?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.