aspose file tools*
The moose likes Applets and the fly likes MID player applet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Applets
Bookmark "MID player applet" Watch "MID player applet" New topic
Author

MID player applet

vikram kamath c
Greenhorn

Joined: Jun 20, 2009
Posts: 15
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

Joined: Feb 23, 2007
Posts: 1561
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

Joined: Jun 20, 2009
Posts: 15
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
Marshal

Joined: Mar 22, 2005
Posts: 42624
    
  65
Do you see the file "20.mid" being requested in the web server logs? Does it have permissions to be served to the world?


Ping & DNS - my free Android networking tools app
vikram kamath c
Greenhorn

Joined: Jun 20, 2009
Posts: 15
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: MID player applet