This example introduces you with the Applet in Java. You will learn how to develop applet code and run in the browser.
Applet is a program provided by java which is designed for execution within the web browser. Applets are mostly used for a small internet and intranet applications because of small size and it's compatibility among almost all web browsers. Applets are also very secure. For example, Applets can be used to serve animated graphics on the web.
This example creates a simple applet that displays Hello World message.
Running Applet from Web browser:
Running applet in browser is very easy job, create an html file with the following code:
The Applet tag in html is used to embed an applet in
the web page.
<APPLET CODE="HelloWorldApplet.class" WIDTH=700 HEIGHT=500>
CODE tag is used to specify the name of Java applet class name. To test your applet open the html file in web browser. You browser should display applet. You can also try this applet online by clicking on the following link.
Try the example online
Download Applet Example
Applet is a program provided by java which is designed for execution within the web browser. Applets are mostly used for a small internet and intranet applications because of small size and it's compatibility among almost all web browsers. Applets are also very secure. For example, Applets can be used to serve animated graphics on the web.
This example creates a simple applet that displays Hello World message.
import java.applet.Applet;
|
Compiling Applets:
javac HelloWorldApplet.java
Running Applet from console:
java HelloWorldApplet
Running Applet from Web browser:
Running applet in browser is very easy job, create an html file with the following code:
<html> <head> <title>A Simple Applet program</title> </head> <body> <APPLET CODE="HelloWorldApplet.class" WIDTH=700 HEIGHT=500> </APPLET> </body> </html> |
<APPLET CODE="HelloWorldApplet.class" WIDTH=700 HEIGHT=500>
CODE tag is used to specify the name of Java applet class name. To test your applet open the html file in web browser. You browser should display applet. You can also try this applet online by clicking on the following link.
Try the example online
Download Applet Example
No comments:
Post a Comment