problem sending strings between two TextArea's each one a thread

Hi all, I have been having problems with a simple message program, i created the program to practice using threads, swing and pipe streams.

The program has two consoles each containing a TextArea each one a Thread.

There are a pair of PipedReader/Writers to send the text represented as a String between TextAreas.

Each console has an pipeOut and pipeIn attribute reading and writing to the pipe.

I wanted to have each program polling the pipe for text being sent but failed to achieve this , just ended up with a TextArea repeatedly filling with the same message sent.

So decided to pass a reference of the other console and call its read method when I sent a message. (did not like this solution but wanted to be able to receive a message on the opposite console)

But once I get the text into the other consoles read method I can not .append it to the TextArea but I can System.out.println();

This is really bugging me and any advice would be great many thanks.

martin

[1039 byte] By [mmartinh] at [2007-9-26 2:15:51]
# 1
Hi,I need more information on the structure of your application...source code please.JRG
j-rg at 2007-6-29 9:13:31 > top of Java-index,Archived Forums,Swing...
# 2
thanks for your reply I have solved the problem, but have a new one . I have a class that reads strings from a pipestream , I would like it to automatically pole the stream to try to read a string and when there is a string just to read it once.. thanks for any hrlp ;)
mmartinh at 2007-6-29 9:13:31 > top of Java-index,Archived Forums,Swing...
# 3
... I would create a new Thread class that read the pipe alle the time and stores it... you other class could call a method inside it that return the data inputed since the last call to the method and then empties itself...JRG
j-rg at 2007-6-29 9:13:31 > top of Java-index,Archived Forums,Swing...
# 4

thanks for your reply, have been trying what you suggested but have difficulty controlling what is read/write i am not sure what to wrap the stream i.e bufferedwriter, bufferedreader and I seem to read the same thing many times and this fills the textarea....

a small example would be great

many thanks

mmartinh at 2007-6-29 9:13:31 > top of Java-index,Archived Forums,Swing...
# 5
... sorry I can not because I have not!!! I never worked on that on an application...JRG
j-rg at 2007-6-29 9:13:31 > top of Java-index,Archived Forums,Swing...