Friday, March 8, 2019

draw string using applet program in java

//step1 : applet1.java

import java.applet.Applet;
import java.awt.Graphics;

public class applet1 extends Applet
{
public void paint(Graphics g)
{
g.drawString("Hello World", 20, 20);
}

}



//step2:  applet1.html

<applet code="applet1" width=200 height=60>
</applet>



//step3: execution

D:\java program\java>javac applet1.java
D:\java program\java>appletviewer applet1.html


output:::




download code ::

click for download




No comments:

Post a Comment