Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applets and sound

 
Juan Carlos Marin
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
I am trying to do an applet for pedagogical purposes that when the mouse is in on them coloured area it will play a WAV file that incledes, for example the vowels.
However, my know-how of the language has not been enough to compile and run it. Thanks in advance for the advice and help.
This is the code that I have tried to implement.
import java.awt.*;
import java.awt.event.*;
import java.applet.Applet.*;
import java.applet.AudioClip.*;
public class TheVowels extends javax.swing.JApplet implements ActionListener{
AudioClip = vowels;
public void initial(){

setBackground(new Color(128, 255, 255));


vowels=getAudioClip(getCodeBase, "vowels.wav")

addMouseListener(new MouseAdapter(){
public void MouseEntered(MouseEvent e){
play(getCodeBase."vowel.wav");
}
public void mouseExited(MouseEvent e){
stop();
}
});

public void paint(Graphics g){
g.drawString("Move your mouse over this area " 80, 100);
}
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic