//
import java.awt.*;
public class Example4 extends BufferedApplet
{
int width = 0, height = 0, x, y;
public void render(Graphics g) {
if (width == 0) {
width = bounds().width;
height = bounds().height;
x = width / 2;
y = height / 2;
}
// DRAW A CLEAR WHITE BACKGROUND
g.setColor(Color.white);
g.fillRect(0, 0, width, height);
// DRAW A BLUE DISK AT x,y
g.setColor(Color.blue);
g.fillOval(x - 20, y - 20, 40, 40);
}
public boolean mouseDown(Event e, int x, int y) {
setXY(x, y);
return true;
}
public boolean mouseDrag(Event e, int x, int y) {
setXY(x, y);
return true;
}
void setXY(int x, int y) {
this.x = x;
this.y = y;
damage = true;
}
}