• 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);
}
}
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!