求助,首先我不懂此语言,望大虾给个结果或说明下
import javax.swing.*;import java.awt.*;
import java.awt.event.*;
class Homework1 extends JFrame
{
int x=-1;
int y=-1;
MdragListener md=new MdragListener();
Homework1()
{
super("画板");
this.addMouseMotionListener(md);
this.setSize(200,200);
this.setVisible(true);
}
public void paint(Graphics g)
{
g.fillOval(x,y,5,5);
}
class MdragListener extends MouseMotionAdapter
{
public void mouseDragged(MouseEvent e)
{
x=e.getX();
y=e.getY();
repaint();
}
}
public static void main(String args[])
{
new Homework1();
}
}