鼠标拖动按纽的问题
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
import java.applet.Applet.*;
public class m1 extends JApplet
{
JButton b1=new JButton("1");
int m_x,m_y;
public void init()
{setLayout(null);
b1.addMouseMotionListener(new MouseMotionAdapter()
{
public void mouseDragged(MouseEvent e)
{
m_x=e.getX();
m_y=e.getY();
b1.setLocation(m_x,m_y);
}
});
b1.setSize(50,50);
add(b1);
}
}
我想用以上的程序实现鼠标拖动按纽的效果!.
问题:在拖动是出现了象残影那样的现象!
请帮我!谢!