Threads and Swing!
I have to work in threads and swing.
I have a class that has some frame components like textarea,textfield and so on.When the button from the frame is clicked, a new working thread is created which reads the input from the InputStream.Now I want to display the read data to the textarea of the frame.How can I do this any idea?I have tried but the message is only printed on the standard output and not displayed on the textarea.
Google for SwingWorker, its made for this, and then have a squiz at the source to see how it re-joins the gui thread, if you interested in the details.
Essentially of the thread has done its thing, it asks the gui thread to do the display when its ready... thats the idea
Thank you the problem now seems to be solved.
I know its old post but this is same problem I have now , anyway I found swing worker difficult to understand is anyway easier to understand for beginner .
Best not to re-activate old threads but rather start your own and link to the old thread if necessary. With SwingWorker as with anything else, it's best to experiment with it a bit with small simple examples to get used to it, and thereby improve your knowledge of how it works. There are lots of examples in this forum that use SwingWorker that you can search for and inspect as well. I'm going to lock this old thread now.
Originally Posted by Wishes