Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
68 views5 pages

Variables

This document defines a class called Int2d that extends the JPanel class. The Int2d class contains a method called figurr that draws different shapes and colors them based on input parameters. It uses if/else statements to check parameters like the shape type (l), x and y coordinates, color (co), and draws polygons by setting colors and filling polygons defined by x and y vertex arrays.

Uploaded by

Nicolas Castillo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
68 views5 pages

Variables

This document defines a class called Int2d that extends the JPanel class. The Int2d class contains a method called figurr that draws different shapes and colors them based on input parameters. It uses if/else statements to check parameters like the shape type (l), x and y coordinates, color (co), and draws polygons by setting colors and filling polygons defined by x and y vertex arrays.

Uploaded by

Nicolas Castillo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Borrador int2d g.setColor(Color.

BLACK);

Dibuja figurr }

if(co==2){

package int2d; g.setColor(Color.BLUE);

import java.awt.Color; if(co==3){

import java.awt.Graphics; g.setColor(Color.CYAN);

import javax.swing.JPanel; }

if(co==4){

public class Int2d extends JPanel{ g.setColor(Color.MAGENTA);

public void figurr ( Graphics g,JPanel p,int l,int x,int y,int }


t , boolean bo, int co){
if(co==5){
int a,b,c,d,e,f,h;
g.setColor(Color.ORANGE);

}
if (bo == false)
if(co==6){
{
g.setColor(Color.PINK);
if (l==3 || l == 4 ){
}
x= t ; y = (170-(t+20));
if(co==7){
}
g.setColor(Color.RED);
if( l==5 || l==6 ){
}
x= t ; y = (170-(t+(t-20)));
if(co==8){
}
g.setColor(Color.WHITE);
if( l==7 || l==8 ){
}
x= 2*t ; y = (170-(3*t-10));
if(co==9){
}
g.setColor(Color.YELLOW);

g.fillPolygon (vx1, vy1, 3);


}

if (l==3){
}
int [] vx1 = {x, x-t, x+t};
else
int [] vy1 = {y,y+t,y+t };
{
if(co==1){
if (l==4){
int [] vx1 = {x,x+t,x+t,x}; else

int [] vy1 = {y, y, y+t,y+t}; {

if(co==1){ if (l==5){

g.setColor(Color.BLACK); a=(int) Math.round(0.7*t);

} int [] vx1 = {x, x-t, x-(a), x+(a), x+t};

if(co==2){ int [] vy1 = {y-35, y+(t-50), y+(t+(t-40)), y+(t+


(t-40)), y+(t-50)};
g.setColor(Color.BLUE);
if(co==1){
}
g.setColor(Color.BLACK);
if(co==3){
}
g.setColor(Color.CYAN);
if(co==2){
}
g.setColor(Color.BLUE);
if(co==4){
}
g.setColor(Color.MAGENTA);
if(co==3){
}
g.setColor(Color.CYAN);
if(co==5){
}
g.setColor(Color.ORANGE);
if(co==4){
}
g.setColor(Color.MAGENTA);
if(co==6){
}
g.setColor(Color.PINK);
if(co==5){
}
g.setColor(Color.ORANGE);
if(co==7){
}
g.setColor(Color.RED);
if(co==6){
}
g.setColor(Color.PINK);
if(co==8){
}
g.setColor(Color.WHITE);
if(co==7){
}
g.setColor(Color.RED);
if(co==9){
}
g.setColor(Color.YELLOW);
if(co==8){
}
g.setColor(Color.WHITE);

}
g.fillPolygon (vx1, vy1, 4);
if(co==9){
}
g.setColor(Color.YELLOW); if(co==7){

} g.setColor(Color.RED);

g.fillPolygon (vx1, vy1, 5); }

} if(co==8){

else { g.setColor(Color.WHITE);

if (l==6){ }

a=(int) Math.round(0.8*t); if(co==9){

b=(int) Math.round(0.1*t); g.setColor(Color.YELLOW);

c=(int) Math.round(0.6*t); }

d=(int) Math.round(1.1*t); g.fillPolygon (vx1, vy1, 6);

e=(int) Math.round(1.65*t); }

int [] vx1 = {x, x-(c), x, x+(d), x+(e),x+(d)}; else

int [] vy1 = {y-(a), y+(b), y+t, y+t, y+(b),y- {


(a)};
if (l==7){
if(co==1){
a=(int) Math.round(0.8*t);
g.setColor(Color.BLACK);
b=(int) Math.round(1.6*t);
}
c=(int) Math.round(2*t);
if(co==2){
d=(int) Math.round(1.4*t);
g.setColor(Color.BLUE);
e=(int) Math.round(0.6*t);
}
f=(int) Math.round(1*t);
if(co==3){
h=(int) Math.round(2.4*t);
g.setColor(Color.CYAN);
int [] vx1 = {x,x-(b), x-(c), x-(a), x+(a),x+
} (c),x+(b)};

if(co==4){ int [] vy1 = {y-(d), y-(e), y+(f), y+(h), y+


(h),y+(f),y-(e)};
g.setColor(Color.MAGENTA);
if(co==1){
}
g.setColor(Color.BLACK);
if(co==5){
}
g.setColor(Color.ORANGE);
if(co==2){
}
g.setColor(Color.BLUE);
if(co==6){
}
g.setColor(Color.PINK);
if(co==3){
}
g.setColor(Color.CYAN);
} int [] vy1 = {y-(a), y-(c), y+(d), y+(e), y+(f),y+
(e),y+(d),y-(c)};
if(co==4){
if(co==1){
g.setColor(Color.MAGENTA);
g.setColor(Color.BLACK);
}
}
if(co==5){
if(co==2){
g.setColor(Color.ORANGE);
g.setColor(Color.BLUE);
}
}
if(co==6){
if(co==3){
g.setColor(Color.PINK);
g.setColor(Color.CYAN);
}
}
if(co==7){
if(co==4){
g.setColor(Color.RED);
g.setColor(Color.MAGENTA);
}
}
if(co==8){
if(co==5){
g.setColor(Color.WHITE);
g.setColor(Color.ORANGE);
}
}
if(co==9){
if(co==6){
g.setColor(Color.YELLOW);
g.setColor(Color.PINK);
}
}
g.fillPolygon (vx1, vy1, 7);
if(co==7){
}
g.setColor(Color.RED);
else
}
{
if(co==8){
if (l==8){
g.setColor(Color.WHITE);
a=(int) Math.round(1.4*t);
}
b=(int) Math.round(2*t);
if(co==9){
c=(int) Math.round(0.7*t);
g.setColor(Color.YELLOW);
d=(int) Math.round(0.6*t);
}
e=(int) Math.round(1.9*t);
g.fillPolygon (vx1, vy1, 8);
f=(int) Math.round(2.6*t);
}
int [] vx1 = {x,x-(a), x-(b), x-(a), x,x+(a),x+
(b),x+(a)};
Dibujo dibujo

} Luna figura

Dibuja1 figura1
}

Borra inten2d

Dibujo jpanel1

Jpanel1 panel11

/Jlabel1

/Jlabel2

/Jbutton1 mov

/X s1

/slider1 s2

/slider2 s3

/y s4

/Jlabel3

/slider3 s5

/xo s6

/label4

/label5

/label6

Pnlzona area

+gridlayout

+dibujo1 figuraa

dibujar() graficar()

You might also like