Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

MID player applet

 
vikram kamath c
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
import java.applet.*;
import java.awt.*;
import java.awt.event.*;

public class PlaySoundApplet1 extends Applet implements ActionListener{
Button play,stop;
AudioClip audioClip;

public void init(){
play = new Button(" Play in Loop ");
add(play);
play.addActionListener(this);
stop = new Button(" Stop ");
add(stop);
stop.addActionListener(this);
audioClip = getAudioClip(getCodeBase(), "20.mid");
}

public void actionPerformed(ActionEvent ae){
Button source = (Button)ae.getSource();
if (source.getLabel() == " Play in Loop "){
audioClip.play();
}
else if(source.getLabel() == " Stop "){
audioClip.stop();
}
}
}

is my code
it works on applet viewer but not on html please help
 
pete stein
Bartender
Posts: 1561
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't compare Strings with == but instead use the equals(...) method. i.e.,


Also, are you sure that your applet is finding your 20.mid file? I know that with JApplets we generally get this information via resources, not files.
 
vikram kamath c
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i see 20.mid loading through the console(for html).but does not come .As i Said before it works fine in APPLET VIEWER but not in HTML only thanks.
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you see the file "20.mid" being requested in the web server logs? Does it have permissions to be served to the world?
 
vikram kamath c
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do i see that? i did not understand. its not in server just clicking on the HTML file of the applet during loading.THANKS
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic