Link to home
Start Free TrialLog in
Avatar of dshrenik
dshrenikFlag for United States of America

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!
Avatar of for_yan
for_yan
Flag of United States of America image

You change table model contents and repaint your table
Avatar of dshrenik

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?
while(true){
Thread.currentThread().sleep(20000);
//get new data and update the model
jtable.repaint();
}

This gets into the constructor?
ASKER CERTIFIED SOLUTION
Avatar of for_yan
for_yan
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial