• Post Reply Bookmark Topic Watch Topic
  • New Topic

How do I stop audio in Java?  RSS feed

 
thomas lim
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to play music when my getoutput method is invoked and stop the music when the invoking is finished. I'm able to do the former but not the latter. How do I stop the music after I've finished invoking the getoutput method?
    
This is my main method which calls the music method and another method not shown in the Student class.
 
Campbell Ritchie
Marshal
Posts: 56541
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please have a look in the Java™ Tutorials. That link shou‍ld tell you how to stop the playback.
Please remind yourself how code tags work; remember to use the preview button. I broke line 12 because it was too long, and you can see how to do it there.
 
Naziru Gelajo
Ranch Hand
Posts: 175
1
Java Netbeans IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would create a method that plays the song and a method that stops playing the song. Then, if this is a GUI based application, I would like create button action event listeners that call each method separately.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!