Skip to Content

Basic Java Applet Example

  1. /*
  2.         Basic Java Applet Example
  3.         This Java example shows how to create a basic applet using Java Applet class.
  4. */
  5.  
  6. import java.applet.Applet;
  7. import java.awt.Graphics;
  8.  
  9. /*
  10.         <applet code = "BasicAppletExample" width = 200 height = 200>
  11.         </applet>
  12. */
  13. public class BasicAppletExample extends Applet{
  14.        
  15.         public void paint(Graphics g){
  16.                 //write text using drawString method of Graphics class
  17.                 g.drawString("This is my First Applet",20,100);
  18.         }
  19. }