Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / July 2006

Tip: Looking for answers? Try searching our database.

flush contents of JTextArea

Thread view: 
trpost@gmail.com - 21 Jul 2006 22:20 GMT
I am using JTextArea to write the status of several URL's, there are
about 100 of them. I am writting the output to the JTextArea and
stdout. When I run through the loop (takes about 60 seconds) to get the
status, I see the results are instantly printed to stdout, but have to
wait for the execution to end before I see anything in the JTextArea.

I am writing to stdout using System.out.println("....") and writing to
JTextArea using textArea1.append("....")

Is there anything I can do to flush the results instantly to the
JTextArea like is done with System.out.println or are there any
inherent flush methods for a JTextArea?

Thanks
Matt Humphrey - 21 Jul 2006 23:10 GMT
>I am using JTextArea to write the status of several URL's, there are
> about 100 of them. I am writting the output to the JTextArea and
[quoted text clipped - 8 lines]
> JTextArea like is done with System.out.println or are there any
> inherent flush methods for a JTextArea?

I would bet that you're writing the results to your text area within the
EDT.  It's busy doing your work instead of updating the screen.  Put your
job into a thread and post updates back to the EDT.

Cheers,
Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/
trpost@gmail.com - 21 Jul 2006 23:54 GMT
Thanks... Logically this makes sense, but I have not done much with
threads... I may need to read up a bit, but if you could provide a
quick example or reference, I would appreciate it.

> >I am using JTextArea to write the status of several URL's, there are
> > about 100 of them. I am writting the output to the JTextArea and
[quoted text clipped - 15 lines]
> Cheers,
> Matt Humphrey matth@ivizNOSPAM.com http://www.iviz.com/
Roland de Ruiter - 22 Jul 2006 11:02 GMT
> Thanks... Logically this makes sense, but I have not done much with
> threads... I may need to read up a bit, but if you could provide a
> quick example or reference, I would appreciate it.

<http://java.sun.com/docs/books/tutorial/uiswing/misc/threads.html>
Signature

Regards,

Roland

Knute Johnson - 22 Jul 2006 00:52 GMT
> I am using JTextArea to write the status of several URL's, there are
> about 100 of them. I am writting the output to the JTextArea and
[quoted text clipped - 10 lines]
>
> Thanks

Show us some actual code.  I've done a lot of what you describe and
never had too much delay.  It will never be as fast as System.out.

Signature

Knute Johnson
email s/nospam/knute/



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.