Você está na página 1de 18

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

CHAPTER 6
APPLET & HTML

MANAGEMENT & SCIENCE UNIVERSITY

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

Objectives
1. Understand how the Web browser controls
and executes the applets.
2. Creates a simple html
3. Familiar with the methods in the Applet class:
init(),start(), stop() and destroy().

MANAGEMENT & SCIENCE UNIVERSITY

TCS 2044 JAVA PROGRAMMING

HTML

CHAPTER 6 APPLET & HTML (Week 11)

HTML and WWW

HTML is a method for representing the appearance and


content of a document using a standard ASCII text file.
HTML consists of reserve markup directives or tags, mixed
with plain text to compose a document.
Purpose of HTML is to transmit the structure of documents
between users.
Can be edited using HTML editor such as notepad, WordPad,
MS Word etc.
File must be saved with extension .html

MANAGEMENT & SCIENCE UNIVERSITY

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

Advantages of HTML

Compatible with any web browser (Systemindependent)


More flexibility in how a document is viewed
Files are small
Easy to learn.

MANAGEMENT & SCIENCE UNIVERSITY

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

Disadvantages of HTML

Limited
Cannot create a new tags
User dont know exactly how a target document will
appear.

MANAGEMENT & SCIENCE UNIVERSITY

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

World Wide Web


Also known as WWW, W3 or the Web
Network
information service, based on the
Internet.
Provides a method of displaying information in
different formats in a way that is fast, powerful,
consistent and easy to use.
Provides a consistent interface for accessing a
wide variety of information from a huge number of
source.

MANAGEMENT & SCIENCE UNIVERSITY

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

HTML Basic
HTML Structure

HTML has 3 tags that describe a documents overall


structure.
- <HTML>
- <HEAD>
- <BODY>
Document structure tags dont affect what the document
looks like when its formatted.
Tags are included to help browsers and search tools learn
about the basic structure of a document.

MANAGEMENT & SCIENCE UNIVERSITY

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

..continue

<HTML> .. </HTML>
The first document structure tag that every HTML
document contains.
Indicates that the content of the file is indeed HTML.
Everything in document should go inside the beginning
and ending HTML tags.

<HTML>
.
Document text

</HTML>

MANAGEMENT & SCIENCE UNIVERSITY

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

..continue

<HEAD> .. </HEAD>

Generally only a few tags go into the heading portion


of a document.
<HTML>
<HEAD>
.
Header information

.
</HEAD>
document text

</HTML>
MANAGEMENT & SCIENCE UNIVERSITY

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

..continue

<BODY> .. </BODY>

The remainder of our html document, including all the


document text is stored inside a <BODY> . </BODY>

Syntax:
<HTML>
<HEAD>
<TITLE> This is the document title </TITLE>
</HEAD>
<BODY>
This is the document text

</BODY>
</HTML>
MANAGEMENT & SCIENCE UNIVERSITY

10

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

Creating and Linking


Documents
Basics of HTML
Writing in paragraph

The text that we type into an HTML file outside of any of the
elements marked by the <HTML>, <HEAD>, <TITLE>, and

<BODY> tags will be displayed as paragraphs.


<P> tag marks the end of a paragraph, and hence a
paragraph break.
A web browser flows all the contents of a paragraph together
from left to right and from top to bottom using the current
window size.

MANAGEMENT & SCIENCE UNIVERSITY

11

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

Line break
Use the line break tag, <BR> to indicate the start of a new
line.
Without line break tag, all text, even text we leave blank in
the HTML, file will run together into a single paragraph.
Should use the <BR> tag when we want to add a line break.

Line
A single tag, <HR>, indicates that the browser should create
a line. Which goes across the width of the display window.
Several parameter passed to the <HR> tag : SIZE, WIDTH,
ALIGN and NOSHADE.

MANAGEMENT & SCIENCE UNIVERSITY

12

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

Heading
Headings mark divisions of a document and divides
sections of a book into parts.
Can have up to six levels of heading.

Syntax:
<H1> course description </H1>

The number indicates the heading level, which can be


<H1> </H1> through <H6>.</H6>.

MANAGEMENT & SCIENCE UNIVERSITY

13

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

Integrating

Text

Text as linking source

Any time someone clicks on any part of the


image, he or she will automatically be brought
to the appropriate hyperlink target

MANAGEMENT & SCIENCE UNIVERSITY

14

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

Example of HTML source code


Heading
<html>
<head>
<title> MSU </title>
</head>
<h1>MSU</h1>
<body bgcolor = "black">
<img src = MSU.jpg" alt = Management & Science University">
<p>MSU is one of the premier institutions of higher learning in Malaysia.
Its main campus is situated in Seksyen 13, Shah Alam</p>
Faculties <A HREF = fise.html"> FISE </A>
<A HREF = fbmp.html"> FBMP </a>
<A HREF = fhls.html"> FHLS </a>
</p>
Linking text
</body>
</html>
MANAGEMENT & SCIENCE UNIVERSITY

15

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

Integrating Image
Advantages of using image
Can convey a great deal of information very well.
Can make a page interesting and exciting

Disadvantages of using image


Can slow down the response time because the extra
data must be transmitted to the web browser.

MANAGEMENT & SCIENCE UNIVERSITY

16

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

Image format

Image can be in most common format s.

<IMG> tag is used to embed in-line graphics into web pages


Syntax : <IMG SRC = msu.jpg>

Image as a linking source

Any time someone clicks on any part of the image, he or

she will automatically be brought to the appropriate


hyperlink target by using the <IMG> and <A> tags.
Syntax
<A HREF = msu.html><IMG SRC = msu.jpg ></A>
MANAGEMENT & SCIENCE UNIVERSITY

17

TCS 2044 JAVA PROGRAMMING

CHAPTER 6 APPLET & HTML (Week 11)

Example of a simple HTML source code


<html>
<head>
<title> MSU</title>
</head>
<body>
<h1> MSU</h1>
<p></p>
<A HREF = msu.html"><IMG SRC = msu.jpg"></A>
</body>
</html>
Image file

MANAGEMENT & SCIENCE UNIVERSITY

18

Você também pode gostar