Re: How do you _really_ get a PrintStream to flush all the time?
- From: "Oliver Wong" <owong@xxxxxxxxxxxxxx>
- Date: Thu, 29 Sep 2005 21:08:26 GMT
"Rob McDonald" <robm@xxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:dhhdts$pik$1@xxxxxxxxxxxxxxxxxxxxxx
>
> Maybe I didn't pour enough of my sorrows into it (I have lots of them, it
> could take a while), but I honestly don't have the slightest idea how this
> is supposed to help me.
You're not alone; based on your description of the problem, it would
seem to me that the source of all this confusion is your use of threads, and
has nothing to do with FileIO.
The situation you've got is a classic problem in multithreading known as
"producer/consumer". You should have a buffer of text (which is NOT the
JTextArea). You've got a producer which will put text into the buffer. You
should have a consumer which eats text out of the buffer and spits it back
out into the JTextArea. You want the producer to not produce text so fast
that it fills up the buffer and starts overwriting itself.
Try this tutorial:
http://java.sun.com/docs/books/tutorial/essential/threads/synchronization.html
- Oliver
.
- Follow-Ups:
- Re: How do you _really_ get a PrintStream to flush all the time?
- From: Rob McDonald
- Re: How do you _really_ get a PrintStream to flush all the time?
- From: Roedy Green
- Re: How do you _really_ get a PrintStream to flush all the time?
- References:
- How do you _really_ get a PrintStream to flush all the time?
- From: Rob McDonald
- Re: How do you _really_ get a PrintStream to flush all the time?
- From: Roedy Green
- Re: How do you _really_ get a PrintStream to flush all the time?
- From: Rob McDonald
- Re: How do you _really_ get a PrintStream to flush all the time?
- From: Rob McDonald
- How do you _really_ get a PrintStream to flush all the time?
- Prev by Date: Re: Why no SSCCEs?
- Next by Date: Re: Artificial Intelligence
- Previous by thread: Re: How do you _really_ get a PrintStream to flush all the time?
- Next by thread: Re: How do you _really_ get a PrintStream to flush all the time?
- Index(es):
Relevant Pages
|