0

I try to append several statustext messages to a JTextArea while downloading a file from a socket. first i declared

private static JTextArea tArea;

and initiate it in my main function. thats working fine. i also have a menu to start a socket within a function in the menu. ive called it test() (for testing purposes.

My problem is, that the second status message doesnt append to the JTextArea until the download is finished. i also output some other status messages during the process and all of them appends after the socket is closed instead of during the process at the time it happens.

Edit: I think its a good article to understand the invoke later function so i will post this link for others who have problems like me. http://www.javamex.com/tutorials/threads/invokelater.shtml Because of this link i understand it.

muni
  • 119
  • 13
  • 1
    Don't block the EDT (Event Dispatch Thread). The GUI will 'freeze' when that happens. See [Concurrency in Swing](https://docs.oracle.com/javase/tutorial/uiswing/concurrency/) for details and the fix. – Andrew Thompson Feb 18 '15 at 00:36
  • thank you please could you explain me why the first append statement is executing, when this is necessary? – muni Feb 18 '15 at 00:42
  • *"but can you explain me.."* For better help sooner, post an [MCVE](http://stackoverflow.com/help/mcve) (Minimal Complete Verifiable Example) or [SSCCE](http://www.sscce.org/) (Short, Self Contained, Correct Example). – Andrew Thompson Feb 18 '15 at 00:44
  • @AndrewThompson i hope my example is ok. thank you. – muni Feb 18 '15 at 00:58

0 Answers0