java中Applet 音乐的使用问题,有谁可以帮我看看不?
importjava.awt.*;importjava.applet.*;importjava.net.*;importjava.awt.event.*;publiccl...
import java.awt.*;
import java.applet.*;
import java.net.*;
import java.awt.event.*;
public class Test2 extends Applet
{
Image image1;
URL url;
public void init()
{
image1=getImage( getDocumentBase() ,getParameter("1"));;
}
public void paint(Graphics g)
{
g.drawImage(image1,0,0,getWidth(),getHeight(),this);
}
AudioClip ac = getAudioClip(getDocumentBase(), "1.au");
ac .play();
//ac.stop();
} 展开
import java.applet.*;
import java.net.*;
import java.awt.event.*;
public class Test2 extends Applet
{
Image image1;
URL url;
public void init()
{
image1=getImage( getDocumentBase() ,getParameter("1"));;
}
public void paint(Graphics g)
{
g.drawImage(image1,0,0,getWidth(),getHeight(),this);
}
AudioClip ac = getAudioClip(getDocumentBase(), "1.au");
ac .play();
//ac.stop();
} 展开
展开全部
这个小程序有些小问题,我帮你改了一下,图像和声音都出来了,你看看吧。
import java.awt.*;
import java.applet.*;
import java.net.*;
import java.awt.event.*;
import java.applet.AudioClip;
public class Test2 extends Applet
{
Image image1;
URL url;
public void init()
{
image1=getImage( getCodeBase() ,"1.jpg");
AudioClip ac = getAudioClip(getCodeBase(),"1.au");
ac.play();
//ac.stop();
}
public void paint(Graphics g)
{
g.drawImage(image1,0,0,getWidth(),getHeight(),this);
}
}
import java.awt.*;
import java.applet.*;
import java.net.*;
import java.awt.event.*;
import java.applet.AudioClip;
public class Test2 extends Applet
{
Image image1;
URL url;
public void init()
{
image1=getImage( getCodeBase() ,"1.jpg");
AudioClip ac = getAudioClip(getCodeBase(),"1.au");
ac.play();
//ac.stop();
}
public void paint(Graphics g)
{
g.drawImage(image1,0,0,getWidth(),getHeight(),this);
}
}
展开全部
参看一下这个:可以实现效果
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
public class UseAudio extends Applet {
public void init() {
}
public void start() {
getAudioClip(getDocumentBase(),"index.mid").play();
}
}
import java.applet.Applet;
import java.awt.Graphics;
import java.awt.Image;
public class UseAudio extends Applet {
public void init() {
}
public void start() {
getAudioClip(getDocumentBase(),"index.mid").play();
}
}
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询