[4624] in java-interest

home help back first fref pref prev next nref lref last post

Bugs in my first applet

daemon@ATHENA.MIT.EDU (Pascal Robert)
Tue Jan 9 16:11:14 1996

To: java-interest@java.Eng.Sun.COM
From: probert@Ergosoft.ergonet.com (Pascal Robert)
Date: Tue, 9 Jan 1996 13:24:05 -0400

Hi!

I recently made a little applet with the JDK beta 2 on our Sun Sparc 5
(Solaris 2.4) who plays four .au sounds one after the other.  here is the
code (sorry for the couple of words in French):

import java.io.*;
import java.awt.*;
import java.applet.*;
import java.util.*;
import java.net.*;

public class ProjetSon extends Applet implements Runnable  {

  Audioclip sounds[];

  public ProjetSon()  {
  }

  void chargeSon()  {

    sounds = new AudioClip[4];
    sounds[0] = getAudioClip(getCodebase(),"sounds/dialtone.au");
    sounds[1] = getAudioClip(getCodebase(),"sounds/laugh.au");
    sounds[2] = getAudioClip(getCodebase(),"sounds/gong.au");
    sounds[3] = getAudioClip(getCodebase(),"sounds/rooster.au");
  }

  public void run()  {

    for (int i = 0; i < 4; i++)  {
      if (sounds[i] != null)  {
        sounds[i].play();
      }
      else  {
        System.out.println("Error");
      }
    }
  }
}

My .html file looks like this:

<html>
<head>
<title>Essai #1</title>
</head>
<body>
<hr>
<applet code=ProjetSon.class width=500 height=300>
</applet>
</body>
</html>

I got no compilation errors or warning and the appletviewer starts with no
complaints and my sounds are in the "sounds" directory.  What's wrong ?

Thanks in advance.

___________________________________________________________________________
Pascal Robert                                   Ergonet

probert@ergonet.com                             http://www.ergosoft.qc.ca
webmaster@ergonet.com                           http://www.ergonet.com
___________________________________________________________________________


-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post