Superman.java
Categorías: CategoryJava | CategoryProgramacion |
1 import java.awt.*;
2
3 import javax.swing.JFrame;
4 class Lienzo extends Canvas{
5 public Lienzo(){
6 setBackground(new Color(138,138,138));
7 }
8 public void paint (Graphics g){
9 for(int j=880; j>10; j-=5){
10 if( j==20){
11 j=870;
12 }
13
14 g.setColor(Color.black);
15 g.fillRect(280, 0, 10, 900);
16 g.fillRect(680, 0, 10, 900);
17 g.setColor(Color.green);
18 g.fillRect(0, 0, 280, 900);
19 g.setColor(Color.green);
20 g.fillRect(690, 0, 380, 900);
21 g.setColor(Color.white);
22 g.fillRect(480, 20, 25, 50);
23 g.fillRect(480, 120, 25, 50);
24 g.fillRect(480, 220, 25, 50);
25 g.fillRect(480, 320, 25, 50);
26 g.fillRect(480, 420, 25, 50);
27 g.fillRect(480, 520, 25, 50);
28 g.fillRect(480, 620, 25, 50);
29 g.fillRect(480, 720, 25, 50);
30 g.fillRect(480, 820, 25, 50);
31 g.fillRect(480, 920, 25, 50);
32 g.setColor(new Color(10,77,233));
33 g.fillRoundRect(450, j+0, 60, 90, 50, 80);
34 g.setColor(Color.black);
35 g.fillOval(460, j-40, 40, 40);
36 g.setColor(new Color(10,77,233));
37 g.fillRoundRect(485, j+85, 20, 100, 20,80);
38 g.fillRoundRect(455, j+85, 20, 100, 20,80);
39 g.fillRoundRect(435, j-50, 20, 90, 15, 85);
40 g.fillRoundRect(507, j+25, 20, 90, 15, 85);
41 g.setColor(Color.red);
42 g.fillRoundRect(458, j+83, 45, 15, 45,15);
43 g.setColor(Color.red);
44 g.fillRoundRect(485, j+170, 20, 15, 20, 10);
45 g.fillRoundRect(455, j+170, 20, 15, 20, 10);
46 g.setColor(new Color(255,179,179));
47 g.fillRoundRect(435, j-50, 20, 15, 20, 10);
48 g.fillRoundRect(508, j+100, 20, 15, 20, 10);
49 g.fillOval(457, j-25, 5, 10);
50 g.fillOval(497, j-25, 5, 10);
51 try{
52 Thread.sleep(20);
53 }
54 catch(Exception e){
55 }
56 g.setColor(new Color(138,138,138));
57
58 g.fillRoundRect(450, j+0, 60, 90, 50, 80);
59 g.fillOval(460, j-40, 40, 40);
60 g.fillRoundRect(435, j-50, 20, 90, 15, 85);
61 g.fillRoundRect(507, j+25, 20, 90, 15, 85);
62 g.fillRoundRect(435, j-50, 20, 90, 15, 85);
63 g.fillRoundRect(507, j+25, 20, 90, 15, 85);
64 g.fillRoundRect(485, j+85, 20, 100, 20,80);
65 g.fillRoundRect(455, j+85, 20, 100, 20,80);
66 g.fillRoundRect(458, j+83, 45, 15, 45,12);
67 g.fillRoundRect(485, j+170, 20, 15, 20, 10);
68 g.fillRoundRect(455, j+170, 20, 15, 20, 10);
69 g.fillRoundRect(435, j-50, 20, 15, 20, 10);
70 g.fillRoundRect(508, j+100, 20, 15, 20, 10);
71 g.fillOval(457, j-25, 5, 10);
72 g.fillOval(497, j-25, 5, 10);
73 }
74
75 }
76
77 }
78
79 public class Animacion{
80 public static void main (String[]args){
81 JFrame marco=new JFrame("animacion");
82 Lienzo l=new Lienzo();
83 marco.add(l);
84 marco.setSize(1000, 900);
85 marco.setVisible(true);
86
87 }
88 }
