源程序:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class DrawRect extends Applet 
implements MouseListener,MouseMotionListener
{
DragRect dragRect=new DragRect();
Point anchorPoint=new Point(0,0);
public void init()
{
addMouseListener(this);
addMouseMotionListener(this);
}
public void mousePressed(MouseEvent Event)
{
anchorPoint.x=Event.getX();
anchorPoint.y=Event.getY();
}
public void mouseDragger(MouseEvent Event)
{
dragRect.setBounds(anchorPoint.x,anchorPoint.y,
Event.getX()-anchorPoint.x,

Event.getY()-anchorPoint.y);
dragRect.normalize();
repaint();

}

public void mouseClicked(MouseEvent Event){}
public void mouseEntered(MouseEvent Event){}
public void mouseExited(MouseEvent Event){}
//public void mousepressed(MouseEvent Event){}
public void mouseReleased(MouseEvent Event){}
public void mouseMoved(MouseEvent Event){}
//public void BUTTON1(){}
//public void BUTTON2(){}
//public void BUTTON3(){}

public void paint(Graphics g)
{
g.drawString("draw mouse to draw a rectangle",30,20);
g.drawRect(dragRect.x,dragRect.y,dragRect.width,dragRect.height);
}
}class DragRect extends Rectangle
{
void normalize()
{
if(width<0)
{
x+=width;
width=-width;
}
if(height<0)
{
y+=height;
height=-height;
}
}
}
错误:
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class DrawRect extends Applet 
implements MouseListener,MouseMotionListener
{
DragRect dragRect=new DragRect();
Point anchorPoint=new Point(0,0);
public void init()
{
addMouseListener(this);
addMouseMotionListener(this);
}
public void mousePressed(MouseEvent Event)
{
anchorPoint.x=Event.getX();
anchorPoint.y=Event.getY();
}
public void mouseDragger(MouseEvent Event)
{
dragRect.setBounds(anchorPoint.x,anchorPoint.y,
Event.getX()-anchorPoint.x,

Event.getY()-anchorPoint.y);
dragRect.normalize();
repaint();

}

public void mouseClicked(MouseEvent Event){}
public void mouseEntered(MouseEvent Event){}
public void mouseExited(MouseEvent Event){}
//public void mousepressed(MouseEvent Event){}
public void mouseReleased(MouseEvent Event){}
public void mouseMoved(MouseEvent Event){}
//public void BUTTON1(){}
//public void BUTTON2(){}
//public void BUTTON3(){}

public void paint(Graphics g)
{
g.drawString("draw mouse to draw a rectangle",30,20);
g.drawRect(dragRect.x,dragRect.y,dragRect.width,dragRect.height);
}
}class DragRect extends Rectangle
{
void normalize()
{
if(width<0)
{
x+=width;
width=-width;
}
if(height<0)
{
y+=height;
height=-height;
}
}
}import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class DrawRect extends Applet 
implements MouseListener,MouseMotionListener
{
DragRect dragRect=new DragRect();
Point anchorPoint=new Point(0,0);
public void init()
{
addMouseListener(this);
addMouseMotionListener(this);
}
public void mousePressed(MouseEvent Event)
{
anchorPoint.x=Event.getX();
anchorPoint.y=Event.getY();
}
public void mouseDragger(MouseEvent Event)
{
dragRect.setBounds(anchorPoint.x,anchorPoint.y,
Event.getX()-anchorPoint.x,

Event.getY()-anchorPoint.y);
dragRect.normalize();
repaint();

}

public void mouseClicked(MouseEvent Event){}
public void mouseEntered(MouseEvent Event){}
public void mouseExited(MouseEvent Event){}
//public void mousepressed(MouseEvent Event){}
public void mouseReleased(MouseEvent Event){}
public void mouseMoved(MouseEvent Event){}
//public void BUTTON1(){}
//public void BUTTON2(){}
//public void BUTTON3(){}

public void paint(Graphics g)
{
g.drawString("draw mouse to draw a rectangle",30,20);
g.drawRect(dragRect.x,dragRect.y,dragRect.width,dragRect.height);
}
}class DragRect extends Rectangle
{
void normalize()
{
if(width<0)
{
x+=width;
width=-width;
}
if(height<0)
{
y+=height;
height=-height;
}
}
}
错误:
DrawRect.java:4: DrawRect is not abstract and does not override abstract method
mouseDragged(java.awt.event.MouseEvent) in java.awt.event.MouseMotionListener
public class DrawRect extends Applet 
请帮助