import java.applet.Applet;
import java.awt.*;
public class Graph1_Shapes extends Applet
{
public void paint(Graphics g)
{
setBackground(Color.gray);
Font font = new Font("Serif", Font.PLAIN, 26);
g.setFont(font);
g.setColor(Color.red);
g.drawString("Welcome to Java",130, 20);
g.setColor(Color.green);
g.drawLine(20,30,20,300);
g.drawLine(20,30,400,30);
g.drawLine(400,30,400,300);
g.drawLine(20,300,400,300);
g.setColor(Color.blue);
g.drawRect(40,50,50,50);
g.drawRect(109,49,51,51);
g.setColor(Color.yellow);
g.fillRect(110,50,50,50);
g.setColor(Color.red);
g.drawOval(50,150,50,50);
g.fillOval(120,150,50,50);
g.drawOval(200,150,90,50);
g.fillOval(305,150,90,50);
g.setColor(Color.magenta);
g.drawArc(50,240,60,60,0,180);
g.fillArc(200,240,60,60,45,180);
}
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.