import java.awt.*;
//java abstract window toolkit
import java.applet.*;
//to make applets
public class FirstApplet
extends Applet {
public void paint(Graphics
g){ //almost everybody calls it g
g.drawString("This
is everyone's first applet.",20,20);
}
}
<HTML>
<HEAD>
<TITLE>First Applet</TITLE>
</HEAD>
<BODY>
<APPLET CODE="FirstApplet.class"
WIDTH=300 HEIGHT=60>
</APPLET>
</BODY>
</HTML>
import java.awt.*; //java abstract window toolkit
import java.applet.*; //to make applets
public class Shapes extends Applet {
public void paint(Graphics g){ //almost
everybody calls it g
g.drawString("This is an applet
using shapes.",20,20);
// Set the line color
Color c =new Color (100, 10,
100); //rgb
g.setColor (c);
//Set the font
Font f;
f = new Font("Helvetica",Font.ITALIC,
24);
g. setFont(f);
g.drawString("First Color",20,90);
//Draw Oval
g.drawOval (40,20,60,35);
//(x,y,wd,ht)
c =new Color (10, 100, 100);
//rgb
g.setColor (c);
g.fillOval (45,25,50,25);
c= new Color(255,0,0); // all
red
g.setColor(c);
g.fillRect(140,60,45,30);
}
}