Web page design
- A static webpage can be designed using HTML.
- HTML file consist of Tag and text. Tags are written between < and > symbol, in order to distinguished it form the text.
- the basic structure of the HTML file is given below:
Applet tag:
-Web documents are written in Hyper Text Markup Language(HTML). HTML uses tags to describe the structure of web document.
-Tags are used to identify heading, paragraphs, and lists, as well as other elements of web page such as link, images, forms and applets.
-Applet are displayed as a part of a web page using the HTML tag <APPLET>.
-Once an applet has been compiled, is included in an HTML file using the APPLET tag. The applet will be executed by a java-enabled web browser when it encounters the APPLET tag within the HTML file.
-Applet tag is used to add the applet into HTML page.
-The syntax for the standard applet tag is shown here.
Attribute
|
Explanation
|
Example
|
Code
|
Name of class file
|
Code=”myApplet.class”
|
Width
|
Width of applet
|
Width=200
|
Height
|
Height of applet
|
Height=50
|
Codebase
|
Applet’s directory
|
Codebase=”/applets”
|
Alt
|
Alternate text if applet is not
available
|
Alt=”menu applet”
|
Name
|
Name of the applet
|
Name=”appletExam”
|
Align(top, left, right, bottom)
|
Justify the applet with text
|
Align=”left”
|
- EXAMPLE:
- Adding Applet to HTML file
- An applet is like a child application of the browser. The browser launches the applet in a predefined environment inside the browser.
- An applet can be added to HTML file using <APPLET> tag.
- The applet tag provide all the information needed to launch the applet.
- There are two ways in which you can run applet:
1. Using Java-compatible web browser.1. Using Java-compatible web browser. 2. Using applet viewer.
- To execute an applet in a web browser, you need to write a short HTML text file that contains the appropriate APPLET tag.
- Here is HTML file that executes MyApplet:
- JDK provides a utility called "appletviewer.exe" for testing applet.
- To execute MyApplet with an applet viewer, you need ti execute the HTML file using applet viewer.
- For example, if the preceding HTML file is called RunApp.html, then the following command line will run MyApplet:
- C:\>appletviewer RunApp.html
- Applet viewer processes only the <applet> tag, and ignores all other rags in the HTML file.Passing parameter to applet:
- It is possible to pass parameter to an applet program, from HTML file.
- In order t pass parameter to Applet program from HTML page, we need to use <PARAM > tag.
- The general sysntax of PARAM tag is given below:
<PARAM NAME=parameter_name VALUE=parameter_value>
- Complete sysntax for the APPLET tag including PARAM tag:
METHOD
|
DESCRIPTION
|
void setBackground(Color colorName)
|
To set the background of an applet window
|
void setForeground(Color colorName)
|
To set the foreground of an applet
window
|
Color getBackground()
|
To obtain the current setting for the
background color
|
Color getForeground()
|
To obtain the setting for the foreground
color
|
Applet getApplet(String name)
|
O obtain the applet specified by giben
name form the current applet context
|
void showStatus(String status)
|
To display the status massage in the
status bar of applet window
|
URL getDocumnetBase()
|
To obtain the directory of the current
browser page
|
URL getCodeBase()
|
To obtain the directory from which the
applet’s class file was loaded
|
No comments:
Post a Comment
If any doubts, please let me know!!!