Sie sind auf Seite 1von 4

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package UAS;

import java.awt.Color;

import java.awt.Graphics;

import java.awt.Polygon;

import javax.swing.JPanel;

/**

* @author ASUS

*/

public class ti3a extends JPanel {

public void paintComponent ( Graphics g) {

Polygon polygon1 = new Polygon();

polygon1.addPoint(900, 200);//2

polygon1.addPoint(800, 100);//1

polygon1.addPoint(400, 400);//3

polygon1.addPoint(500, 500);//4

g.setColor(Color.GRAY);

g.fillPolygon(polygon1);
Polygon polygon2 = new Polygon();

polygon2.addPoint(550, 30);//2

polygon2.addPoint(668, 200);//1

polygon2.addPoint(590, 260);//3

polygon2.addPoint(500, 120);//4

g.setColor(Color.GRAY);

g.fillPolygon(polygon2);

Polygon polygon3 = new Polygon();

polygon3.addPoint(680, 365);//2

polygon3.addPoint(758, 305);//1

polygon3.addPoint(930, 480);//3

polygon3.addPoint(810, 500);//4

g.setColor(Color.GRAY);

g.fillPolygon(polygon3);

g.setColor(Color.GRAY);

g.fillOval(359, 485, 30, 35);

Polygon polygon4 = new Polygon();

polygon4.addPoint(400, 400);//2

polygon4.addPoint(500, 500);//1

polygon4.addPoint(380, 520);//3

polygon4.addPoint(360, 500);//4

g.setColor(Color.GRAY);

g.fillPolygon(polygon4);
Polygon polygon5 = new Polygon();

polygon5.addPoint(410, 420);//2

polygon5.addPoint(470, 480);//1

polygon5.addPoint(420, 480);//3

polygon5.addPoint(400, 450);//4

g.setColor(Color.BLACK);

g.fillPolygon(polygon5);

Polygon polygon6 = new Polygon();

polygon6.addPoint(900, 200);//2

polygon6.addPoint(800, 100);//1

polygon6.addPoint(950, 40);//3

polygon6.addPoint(960, 50);//4

g.setColor(Color.GRAY);

g.fillPolygon(polygon6);

/*

* To change this license header, choose License Headers in Project Properties.

* To change this template file, choose Tools | Templates

* and open the template in the editor.

*/

package UAS;

import javax.swing.JFrame;

/**
*

* @author ASUS

*/

public class uas1401002 {

public static void main (String[] args) {

JFrame frame = new JFrame("ALL TUGAS");

frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

ti3a uas = new ti3a();

frame.add(uas);

frame.setSize(1374, 700);

frame.setVisible(true);

Das könnte Ihnen auch gefallen