public class HouseApplet extends JApplet
1: import javax.swing.*;
2: import java.awt.*;
3:
4: public class HouseApplet extends JApplet
5: {
6: private int[] xHouse = {150, 150, 200, 250, 250};
7: private int[] yHouse = {100, 40, 20, 40, 100};
8: private int[] xDoor = {175, 175, 200, 200};
9: private int[] yDoor = {100, 60, 60, 100};
10: private int[] xWindow = {220, 220, 240, 240};
11: private int[] yWindow = {60, 80, 80, 60};
12:
13: public void paint(Graphics canvas)
14: {
15: this.setBackground(Color.LIGHT_GRAY);
16: canvas.setColor(Color.GREEN);
17: canvas.fillPolygon(xHouse, yHouse, xHouse.length);
18: canvas.setColor(Color.BLACK);
19: canvas.drawPolyline(xDoor, yDoor, xDoor.length);
20: canvas.drawPolygon(xWindow, yWindow, xWindow.length);
21: }
22: }