How to print Text in Java Applet?

Hello Friends, 

Today I will explain how can we print “HELLO” or Any text in Java Applet.
In this  program I have print only “HELLO” but you can choose any text you like.

import java.applet.*;
import java.awt.*;
import java.awt.event.*;


public class first extends Applet
public void paint(Graphics g)
g.drawString("first applet..........",100,200);
  1. If I am write the during setting the frame width and hight that applet code should be the exactly same as the filename. for example in your code there is applet code=first so i assume you had created applet file with name 'first'.

Leave a Reply