You are on page 1of 3

Clase principal:

import javax.swing.JFrame;

public class poligonos {

public static void main(String[] args) {

lados h = new lados();

h.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

h.setVisible(true);

h.setSize(1000, 1000);

h.setLocationRelativeTo(null);

clase secundaria:

import java.awt.Color;

import java.awt.Graphics;

import javax.swing.JFrame;
public class lados extends JFrame {

public lados(){

super("figurasxd");

public void paint (Graphics h){

super.paint(h);

Color negro = new Color (0,0,0);

int [] vx1 = {250,300,350, 350,300,250,200,200};

int [] vy1 = {50, 50,100,150,200,200,150,100};

h.fillPolygon(vx1,vy1,8);

int [] vx2 = {400, 500, 450, 350, 300 };

int [] vy2 = {500, 550, 650, 650, 550 };

h.fillPolygon(vx2,vy2,5);

int [] vx3 = { 300,400,450, 400, 300, 250 };


int [] vy3 = {200, 200, 250, 350, 350, 250 };

h.fillPolygon(vx3,vy3,6);

int [] vx4 = { };

int [] vy4 = { };

h.fillPolygon(vx4,vy4,3);

}}

You might also like