Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Thread and JTextArea

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
I'm creating a clustering software.
In this soft, i'dlike to informe the user of the advance of the clustering in rreal time by a JTextArea.
I have made a thread that direct the System.Out to the JTextArea.
But all the message are printed once the clustering is finished !!
for example , If I do :
public void dofileread(){
System.out.println("read the file FIC");
fileread(FIC);
}
the programme reads the file before printing the message.

Thanks for help

Benoit
 
To get this functionality, the JTextArea must be in one thread and the file read must be done in another.
Since you say that your are redirecting the system out, I assume you have taken care of the first part. Just make sure that the file reading process is threaded and is not in the text area thread. If the read part is not threaded, it will prevent the real-time updates. Another problem may be that you are not flushing the output. Println does this, but if you are using print, the output will not be available until a flush() or println() is called.

Hope this helps.

BTW, are you using PipedInputStream and PipedOutputStream?
[morning] HavaTheJut
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top