import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class paint extends Applet implements MouseMotionListener{
Graphics g;
public void init()
{
g = getGraphics();
this.addMouseMotionListener(this);
}
public void mouseDragged(MouseEvent e) {
g.fillRect(e.getX(), e.getY(), 10, 10);
}
public void mouseMoved(MouseEvent arg0) {
}
}
outout:
import java.awt.*;
import java.awt.event.*;
public class paint extends Applet implements MouseMotionListener{
Graphics g;
public void init()
{
g = getGraphics();
this.addMouseMotionListener(this);
}
public void mouseDragged(MouseEvent e) {
g.fillRect(e.getX(), e.getY(), 10, 10);
}
public void mouseMoved(MouseEvent arg0) {
}
}
outout:
No comments:
Post a Comment
SAY HELLO!!