我写了个简单的图形程序,在背景图上点击鼠标会循环更换背景图片,并且添加了背景音乐,但是不知道为什么,点几次鼠标,换几张背景之后,音乐自动就停了(音乐很长的)大家帮帮忙,看看到底哪出错了,谢谢大家了!!我都纠结一天了,难道是系统的repaint()有什么问题吗。。请大家帮帮我,谢谢!  以下是代码:import java.applet.Applet;
import java.applet.AudioClip;
import java.awt.EventQueue;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.event.InputEvent;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
import javax.swing.JLabel;public class Heaven001
{
public static void main(String[] args)
{
EventQueue.invokeLater(new Runnable()
{
public void run()

{
myframe frame  = new myframe();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

frame.setResizable(false);

frame.setVisible(true);
}
});
}
}class myframe extends JFrame
{
public myframe()
{
setTitle("Super Box");
setSize(1024,768);

mybgimage bgmap=new mybgimage("00","jpg",13,0,0,1024,768);

add(bgmap);
playsound("002",true);
}
public void playsound(String x,boolean goon)
{
URL cb;  
music = new File("./sound/"+x+".wav");
try 
{
cb = music.toURL();
AudioClip aau;  
    aau = Applet.newAudioClip(cb);
    if(goon)
     aau.loop();
    else
     aau.play();
}
catch (MalformedURLException e) 
{
e.printStackTrace();
}
}
private File music;
}class mybgimage extends JLabel
{
public mybgimage(String name,String imgtype,int have,int x,int y,int xwide,int yhigh)
{
try
{
picturename=name;
picturetype=imgtype;
bgpicture = ImageIO.read(new File("./image/"+picturename+"0."+picturetype));
}
catch (IOException e)
{
e.printStackTrace();
}
havenumber=have;
beginx=x;
beginy=y;
picwide=xwide;
pichigh=yhigh;
bgnumber=0;
addMouseListener(new MouseHandler());
}
private class MouseHandler extends MouseAdapter
{
public void mouseClicked(MouseEvent event)
{
if((event.getModifiers()&InputEvent.BUTTON3_MASK)!=0)
bgnumber+=havenumber-1;
else
++bgnumber;
bgnumber=bgnumber%havenumber;
try
{
bgpicture = ImageIO.read(new File("./image/"+picturename+bgnumber+"."+picturetype));
}
catch (IOException e)
{
e.printStackTrace();
}
repaint();
}
}
public void paintComponent(Graphics g)
{
if(bgpicture==null)
return;
g.drawImage(bgpicture,beginx,beginy,picwide,pichigh,null);
}
 private Image bgpicture;
 private String picturename,picturetype;
 private int bgnumber,havenumber,beginx,beginy,picwide,pichigh;
}