Java Programming

12.4 Designing a Web Page

Java applet are programs that reside on web page. A web page is basically made up of text and HTML tags that can be interpreted by a web browser or an applet viewer.

HTML files should be stored in the same directory as the compiled code of the applets.

A web page is marked by an opening HTML tag and closing HTML tag and is divided into the following three major parts:
1. Comment Section
2. Head Section
3. Body Section

Comment Section
This is very first section of any web page containing the comments about the web page functionality. A comment line begins with and the web browsers will ignore the text enclosed between them. The comments are optional and can be included anywhere in the web page.

Head Section
This section contains title, heading and sub heading of the web page. The head section is defined with a starting tag and closing tag.
Hello World Applet
Body Section
The entire information and behaviour of the web page is contained in it, It defines what the data placed and where on to the screen. It describes the color, location, sound etc. of the data or information that is going to be placed in the web page.

Hi, This is My First Java Applet on the Web!

Applet Tag
The tag supplies the name of the applet to be loaded and tells the browser how much space the applet requires.
The tag given below specifies the minimum requirements to place the Hellojava applet on a web page.

This HTML code tells the browser to load the compiled java applet Hellojava.class, which is in the same directory as this HTML file.
It also specifies the display area for the applet output as 400 pixels width and 200 pixels height.

After you create this file, you can execute the HTML file called RunApp.html (say) on the command line.
c:\ appletviewer RunApp.html

Download for more knowledge

https://play.google.com/store/apps/details?id=ab.java.programming

Leave a comment