Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Do more than one task at the same time.  RSS feed

 
James Dark
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi. I've nearly completed my computer science project but have one major problem. When I play my music files, it makes it so nothing else can occur at the same time. Is there anyway to play a music file and have my program run simultaneously?

Thanks for your help.
 
Blake Minghelli
Ranch Hand
Posts: 331
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to learn about Threading. Threading allows your application to run more than one "process" at the same time. In a nutshell, you could launch your music file in a separate thread so that the rest of your application can continue without waiting for the music to complete.

There is a Thread Tutorial on java.sun.com or you may also want to check out the Threads Forum here on JavaRanch.
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the Threads and Synchronization forum...
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!