Write a program in java to draw the image using the applet. 

To execute the applet by appletviewer tool, create an applet that contains applet tag in the comment and compile it. After that run it by appletviewer First.java. Now Html file is not required but it is for testing purpose only. 

Program Code:
import java.applet.Applet; 
import java.awt.Graphics; 
public class First extends Applet
public void paint(Graphics g)
g.drawRect(10,10,50,100); 
g.drawRect(10,10,50,100); 
/* <applet code="First. class" width="300" height="300"> </applet> */

Output: 
To execute the applet by appletviewer tool, write in command prompt: 
c:\>javac First.java c:\>appletviewer First.java
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: