Source Code:
import java.applet.*;
import java.awt.*;
public class Demo1 extends Applet
{
public void init()
{
//Code to run automatically
this.setSize(500, 500);
this.setBackground(Color.CYAN);
}
public void paint(Graphics g)
{
//now draw graphics
g.drawLine(0, 0, 100, 100);
g.drawRect(0, 0, 100, 100);
//change color of graphics
g.setColor(Color.blue);
g.drawString("Applet Demo", 0, 120);
}
}
No comments:
Post a Comment