Thanks Steve for your help.
I tried to find a way to implement your suggestion without success. I don't know a lot about 'Event-Dispatch-Thread'. I would really appreciate if you give me an example or a link to a tutorial on how to do this.
Actually my application is trying to control MPlayer (in slave mode) through its output stream and getting the answers from the input stream. I'm using a base code from:
http://beradrian.wordpress.com/2008/01/30/jmplayer/
On the other hand, I faced a lot of problems in using PipedInputStream/PipedOutputStream since they are *sometimes* start to consume a lot of CPU in idle cases. So I remove them and use wait()/notify() to replace the waitForAnswer() function.
I couldn't make it works.
I appreciate your comments