Updating a JTextArea
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Alan_Cox
Posted On:   Wednesday, July 11, 2001 07:09 PM

I am writing an application that sends out emails (to a group of people that are on a survey panel). After each email has been sent, I would like to update a JTextArea with the append() method with something like this:

myemail@someplace.com ... Success




Right now, nothing new is displayed in the text area until all the emails are sent out. Then all at once, 900 some lines pop up displaying either success or failure.



I'd like each email to display individually (even if that slows the execution of the app), so that the user can see the progress.



Thanks

Re: Updating a JTextArea

Posted By:   Alex_Chaffee  
Posted On:   Monday, July 16, 2001 01:00 AM

You're probably doing your thing inside an event listener. That means you're using the AWT thread. It can't update the TextArea since it's busy sending your emails. Search the AWT FAQ and Swing FAQ for information on the AWT Thread and the SwingUtils.invokeLater method.


If so, then you should spawn a thread to send the emails.


BTW, this is really a Swing question, not a Threads question.

About | Sitemap | Contact