1 /*
2 * autor:Carlos Alberto Velasquez Pacman vs miss pacman
3 */
4
5
6
7
8 import java.awt.*;
9 import javax.swing.*;
10
11 class lienzo extends Canvas {
12 public void paint(Graphics gol){
13
14
15 for (int i=0 ; i <50 ; i++){
16 gol.setColor(Color.PINK);
17 gol.fillArc(i*10,100,50,50,30,305);
18 gol.setColor(Color.green);
19 gol.fillArc(i*10+70,100,20,20,30,305);
20 gol.fillRect(i*10+75,95,10,5);
21 gol.fillRect(i*10+78,90,5,5);
22
23 try {
24 Thread.sleep(100);
25 }
26
27 catch (Exception e){
28 }
29 gol.setColor(Color.PINK);
30 gol.fillOval(i*10,100,50,50);
31 gol.setColor(Color.green);
32 gol.fillOval(i*10+70,100,20,20);
33 gol.fillRect(i*10+75,95,10,5);
34 gol.fillRect(i*10+78,90,5,5);
35 try {
36 Thread.sleep(50);
37 }
38
39 catch (Exception e){
40 }
41 gol.setColor(Color.BLACK);
42 gol.fillRect(i*10,100,50,50);
43 gol.fillOval(i*10+70,100,20,20);
44 gol.fillRect(i*10+75,95,10,50);
45 gol.fillRect(i*10+78,90,5,5);
46 }
47 }
48 }
49
50
51 public class Dibujo {
52
53 public static void main(String[] args) {
54 JFrame marco = new JFrame ("Dibujo");
55 lienzo l = new lienzo ();
56 l.setBackground(Color.BLACK);
57 marco.add(l);
58 marco.setSize(600,600);
59 marco.setVisible(true);
60 }
61 }
