I need to loop the one sound so that the timer will make it so the sound will play then delay 5 seconds and then play again.

My source code is:

import java.awt.*;
import javax.swing.*;
import java.applet.AudioClip;
public class Morning extends JApplet
{
  private AudioClip rooster;
  private final int dealy = 5000;
  private Timer t;
  public Morning()
  {
    t = new Timer(delay, this);
  }
  public void init()
  {
   rooster = getAudioClip(getDocumentBase(),
                               "roost.wav");
   rooster.play();
   t.start();

   Container c = getContentPane();
   c.setBackground(Color.white);
  }
}

Can anybody please help me?

Recommended Answers

All 2 Replies

Is there like anybody here. I posted this like 2 days ago.

were all dumb and dont know ??? no just joking .. youll find someone once there online...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.