Applet Refresh and User Interface Methods
boolean finished = false;
public void paint(Graphics g) {
if (finished)
g.drawImage(screen, 0, 0, this);
}
// this overide avoid the unnecessary clear on each paint()
public void update(Graphics g) {
paint(g);
}
public boolean mouseDown(Event e, int x, int y) {
renderPixel(x, y);
repaint();
return true;
}
public boolean mouseDrag(Event e, int x, int y) {
renderPixel(x, y);
repaint();
return true;
}
public boolean mouseUp(Event e, int x, int y) {
renderPixel(x, y);
repaint();
return true;
}
|