This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
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.
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.