File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Threads and Synchronization and the fly likes Java Newbie Problem - streaming Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Threads and Synchronization
Bookmark "Java Newbie Problem - streaming" Watch "Java Newbie Problem - streaming" New topic

Java Newbie Problem - streaming

wayne whitman

Joined: Sep 14, 2008
Posts: 10
Hi All - I have a desktop application that needs to respond to user input at all times. But, it also connects to an internet device where it needs to receive streaming audio. The problem I am having is how to code the program so it will respond to user commands via the gui at any time, but still receive the streaming audio from the internet device at the same time. I tried putting the streaming audio reception in a separate thread, but that doesn't work. The program either runs one thread or the other and since the streaming audio is continuous, it never goes back to the gui thread.

Any ideas welcomed and thanks!
Mark Vedder
Ranch Hand

Joined: Dec 17, 2003
Posts: 624

Multiple threads is exactly what you need. The problem is likely how you are launching the thread. Or in the thread implementation. To properly help you though, we would need to know more information about your code and its design. Can you tell us a bit more and post some of the relevant code?

Also, have you read the Sun Java Tutorial's Concurrency in Swing lesson? It explains some important concepts on multi-threading in a swing application.
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 46349
Sounds too complicated a question for beginners'. Moving.
wayne whitman

Joined: Sep 14, 2008
Posts: 10
Thanks Mark. See, it really was a newbie question as this is my first Java program and I was not aware of that tutorial.
Should be able to solve it from here.
I agree. Here's the link:
subject: Java Newbie Problem - streaming
It's not a secret anymore!