java - GUI - Display lines one by one on a JTextPane and make a related JProgressBar -
how display lines 1 one on jtextpane
, make related jprogressbar
?
i have loop:
int k; (k=0; k<array_txt.length; k++) { if (array_txt[k] != null) { textpane.append( array_txt[k] ); } }
i'd append every line array_txt[k]
(string) on jtextpane
1 one after few seconds , has synchronized jprogressbar
.
in way every time k
has different value print on text pane , progress bar related prints.
i have read thread.sleep(x);
don't know put in order reach aim.
don't block edt (event dispatch thread) - gui 'freeze' when happens. instead of calling thread.sleep(n)
implement swing timer
repeating tasks or swingworker
long running tasks. see concurrency in swing more details.
Comments
Post a Comment