Chapter 21 ■ Questions and answers: Finishing the setup Methods and digital audio
Since the game board spins longer than seven seconds, you will need to also add a setCycleCount()
method call and set it to the INDEFINITE (infinite loop) data value using the following Java 9 code, also
shown in Figure 21-35:
spinnerAudio.setCycleCount(AudioClip.INDEFINITE);
Now that your spin AudioClip asset is set up, we now have to trigger it when the spinner UI is clicked
with the mouse.
Figure 21-34. Go back to the instantiation and add the spinner.wav audio file and the toExternalForm()
method chain
Figure 21-35. Add a slash (/), or root, to spinner.wav. Then add a spinnerAudio.setCycleCount(AudioClip.
INDEFINITE) method call