Only play the sound once  previous clip has e

I’m usind java.applet.AudioClip for the sounds in my game. Some sounds are played when when a button is pressed. If you keep your finger down on the button or press it very quickly it starts playing the sound from the begining, before the previous one has finished playing. Is there any way to prevent this?

Thanks