package interfaces;
import java.awt.*;
public class GraficsTest extends Frame{
/**
* @param args
*/
public static void main(String[] args) {
new GraficsTest().setVisible(true);
}
public GraficsTest()
{
this.setTitle("Grafics test");
this.setBackground(Color.LIGHT_GRAY);
this.setSize(300,200);
}
public void paint(Graphics g)
{
g.setColor(Color.LIGHT_GRAY);
g.draw3DRect(10, 30,this.getWidth()-20,this.getHeight()-40,true);
g.setColor(Color.BLACK);
g.drawLine(15, 35, 65, 65);
g.drawRect(70,35,50,30);
g.drawRoundRect(125, 35, 50, 30, 10, 10);
g.drawOval(180, 35, 50, 30);
g.drawArc(235, 35, 50, 30, 25, 200);
int[]x={15,65,15,65};
int[]y={90,90,120,120};
g.drawPolygon(x, y,x.length);
g.setColor(Color.RED);
g.fillRect(70,90,50,30);
g.fillRoundRect(125,90,50,30,10,10);
g.fillOval(180, 90,50,30);
g.fillArc(235,90,50,30,25,200);
g.setColor(Color.BLACK);
g.setFont(new Font("SansSerif",Font.PLAIN,9));
g.drawString("Linea",30, 80);
g.drawString("rectangulos",95,80);
g.drawString("ovalo", 192,80);
g.drawString("arco",250,80 );
g.drawString("poligono",22,135);
g.drawString("rectangulos",95,135);
g.drawString("ovalo",192,135);
g.drawString("arco",250,135);
}
}
No hay comentarios:
Publicar un comentario