Chapter 13. Applets and HTML HTML Applets Computer Programming with JAVA.

Slides:



Advertisements
Similar presentations
Math Introduction to HTML Gavin Shaddick
Advertisements

Learn about Java applets. Know the differences between Java applets and applications. Designing and using Java applets Running Java applets. Security.
Internet Services and Web Authoring (CSET 226) Lecture # 5 HyperText Markup Language (HTML) 1.
Dept. of Computer Science - SSBN Java Applets Vishnuvardhan.M.
HTML. The World Wide Web Protocols Addresses HTML.
INTRODUCTION TO HYPERTEXT MARKUP LANGUAGE 1. Outline  Introduction  Markup Languages  Editing HTML  Common Tags  Headers  Text Styling  Linking.
Introduction to HTML Bent Thomsen Institut for Datalogi Aalborg Universitet.
1 Chapter 9 Introduction to HTML and Applets Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
Chapter 4 Marking Up With Html: A Hypertext Markup Language Primer.
Hypertext Markup Language. Platform: - Independent  This means it can be interpreted on any computer regardless of the hardware or operating system.
HTML Hypertext Markup Language –First proposed by CERN in 1989 –It is non-linear so it allows you to jump from place to place –Markup refers to the structure.
CIS101 Introduction to Computing Week 05. Agenda Your questions Exam next week - Excel Introduction to the Internet & HTML Online HTML Resources Using.
Slides prepared by Rose Williams, Binghamton University Chapter 18 Applets.
1 Applets Chapter 1 To understand:  why applets are used to extend the capabilities of Web pages  how an applet is executed and know about the restrictions.
Chapter 12Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Announcements/Reminders l Happy Tax Day! l Project 8 due on Thursday.
Java Applets. Lecture Objectives Learn about Java applets. Know the differences between Java applets and applications. Designing and using Java applets.
Introduction to HTML 2006 CIS101. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
Introduction to HTML 2006 INT197B. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
MA10126 Introduction to HTML Gavin Shaddick
Introduction to HTML 2004 CIS101. What is the Internet? Global network of computers that are connected and communicate via a series of Protocols Protocols.
Internet Publishing / Dreamweaver Luke E. Reese CARRS
HTML Companion. Lecture Objectives Learn about HTML. Know basic HTML tags.
Chapter 20 Applets Slides prepared by Rose Williams, Binghamton University Copyright © 2008 Pearson Addison-Wesley. All rights reserved.
Computer Science 103 Chapter 2 HyperText Markup Language (HTML)
Developing a Basic Web Page with HTML
Applets, HTML and GUI’s Recitation – 04/11/2008 CS 180 Department of Computer Science, Purdue University.
Glencoe Digital Communication Tools Create a Web Page with HTML Chapter Contents Lesson 4.1Lesson 4.1 Get Started with HTML (85) Lesson 4.2Lesson 4.2 Format.
CIS101 Introduction to Computing Week 06. Agenda Your questions Excel Exam during second hour Our status after the snow day Introduction to the Internet.
Chapter 4 Fluency with Information Technology L. Snyder Marking Up With HTML: A Hypertext Markup Language Primer.
Exploring Microsoft Office XP - Microsoft Word 2002 Chapter 61 Exploring Microsoft Word Chapter 6 Creating a Home Page and Web Site By Robert T. Grauer.
McGraw-Hill/Irwin © The McGraw-Hill Companies, All Rights Reserved TECHNOLOGY PLUG-IN T10 Creating Web pages Using HTML.
Chapter 16 The World Wide Web. 2 The Web An infrastructure of information combined and the network software used to access it Web page A document that.
Chapter 13Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 13 l HTML l Applets Applets and HTML.
HTML HyperText Markup Language Constantly evolving - extra facilities being added regularly Java applets and JavaScript used to increase functionality.
Web Design ITM 2010 Tutorial 1 Prepared by Wang Shiyu.
HTML (HyperText Markup Language)
Understanding HTML Code
Applets Chapter 17.  Java’s big splash onto the scene came in the mid 90’s. The people at Sun Microsystems had managed to work java programs into Web.
CP2022 Multimedia Internet Communication1 HTML and Hypertext The workings of the web Lecture 7.
XP Mohammad Moizuddin Creating Web Pages with HTML Tutorial 1 1 New Perspectives on Creating Web Pages With HTML Tutorial 1: Developing a Basic Web Page.
Introduction to HTML. What is a HTML File?  HTML stands for Hyper Text Markup Language  An HTML file is a text file containing small markup tags  The.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2009 Pearson Education, Inc., Upper.
Web Programming Basics of HTML. HTML stands for Hyper Text Mark-up Language A mark-up language is different than those that you have learned before in.
HTML Hyper Text Markup Language. What is an HTML File?  HTML stands for Hyper Text Markup Language  An HTML file is a text file containing small markup.
HTML,DHTML & Javascript/Session1/1 of 39 Introduction and Basic Tags Session 1 of Using HTML, DHTML & JavaScript.
Chapter 8 Introduction to HTML and Applets Fundamentals of Java.
Chapter 16 The World Wide Web Chapter Goals Compare and contrast the Internet and the World Wide Web Describe general Web processing Write basic.
1 Week 1 l HTML l Applets Applets and HTML. 2 Overview l Applets: Java programs designed to run from a document on the Internet l HTML: Hypertext Markup.
1 Creating Web Pages Part 1. 2 OVERVIEW: HTML-What is it? HyperText Markup Language, the authoring language used to create documents on the World Wide.
Chapter 13Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 13 l HTML l Applets Applets and HTML.
Lec.10 + (Chapter 8 & 9) GUI Java Applet Jiang (Jen) ZHENG July 6 th, 2005.
Ali Alshowaish. What is HTML? HTML stands for Hyper Text Markup Language Specifically created to make World Wide Web pages Web authoring software language.
Applets Yong Choi School of Business CSU, Bakersfield.
Chapter 2 Designing Web Pages With HTML JavaMethods An Introduction to Object-Oriented Programming Maria Litvin Gary Litvin Copyright © 2003 by Maria Litvin,
HTML BTEC National in Computing Section5. Create Information “HTML: defining HTML, discussing HTML uses and demonstrating HTML basics, HTML structure…..
Introduction to Computers 12/6/ BEGINNING HTML DESIGNING YOUR OWN WWW PAGES.
HTML Basics Computers. What is an HTML file? *HTML is a format that tells a computer how to display a web page. The documents themselves are plain text.
Chapter 131 Applets and HTML Chapter Objectives learn how to write applets learn to write a simple HTML document learn how to embed an applet in.
HTML Basics. HTML Coding HTML Hypertext markup language The code used to create web pages.
HTML – The Basics COE 201- Computer Proficiency. The Internet The World Wide Web ▫Also known as the Web ▫Created in 1989  European Laboratory for Particle.
Internet Publishing / Dreamweaver Luke E. Reese Biosystems & Ag. Engr. / CARRS
HTML tags and attributes By: Dennis Champagne. List of tags.
Slides prepared by Rose Williams, Binghamton University ICS201 Lecture 17 : Applets King Fahd University of Petroleum & Minerals College of Computer Science.
Introduction to HTML.
Java Applets.
Chapter 27 WWW and HTTP.
Chapter 13 Applets and HTML HTML Applets.
Chapter 16 The World Wide Web.
Presentation transcript:

Chapter 13. Applets and HTML HTML Applets Computer Programming with JAVA

Overview Applets: Java programs designed to run from a document on the Internet HTML: Hypertext Markup Language a language used to create Internet documents Applets run within an HTML document HTML documents are run by a web browser, e.g. Netscape Navigator or Microsoft Internet Explorer

HTML: Hypertext Markup Language Hypertext: text with items you can click with a mouse to send you to another document Link: an item you can click with the mouse to go to another document also called hyperlink Page: an HTML document it is not equal to a page of print or a single screen of display HTML page and HTML document mean the same thing HTML is a "suggestive formatting" language it is not a full-blown programming language like Java it suggests to the browser how to display text or other objects

HTML basics Most HTML commands are of the form some text Some commands do not require the part HTML is not case sensitive i.e. the commands are not text displays in whatever case it is in in the document HTML files are plain text files created with any text editor HTML file names should follow the operating system's rules and end in.html

A few HTML commands Page Title Heading 1- largest, most prominent heading text Heading 2 - a sub-heading, etc. Additional sub-headings Break - begin a new line( not required) Paragraph - begin a new paragraph ( not required) Comment field - not displayed by browser text Center text horizontally on page Used for browser "book marks" (displays in browser title bar)

Outline of a basic page and a few more HTML commands begin an HTML document begin the document's header (title usually goes here) end of document's header begin stuff that will appear in the main window of the browser blank lines are ignored - use them to make code more readable (body of html document: html commands, text, applets, etc.) end stuff that displays in main window of browser date and link to the address that follows ( address of person maintaining the page) end address end the HTML document

HTML: suggestive formatting Most HTML commands suggest rather than dictate how text will be displayed For example, Heading 1 in one browser may be in Arial font but another browser may display it in Times New Roman the font size and other attributes may differ as well Different browsers and systems also result in different line breaks, colors, etc., so WYSIWYG (What You See Is What You Get) does not apply to either the text HTML file or what displays in your browser getting HTML documents to display nicely in all browsers and systems is important but non-trivial the examples used here are simple and should be a problem, so we will not go into any detail about differences in browsers

Inserting a hyperlink Hyperlinks - The real power of HTML Syntax: text to display the path can be local - any absolute or relative path to a local file or... It can be a URL (internet address) plus path name to a file on a remote system! Example: Walter Savitch Displays as: Walter Savitch

URL: Uniform Resource Locator An internet address that uniquely identifies a location A kind of path name for the Internet But not just an ordinary address the first part tells what protocol to use to make the link a protocol is a set of rules for transferring and interpreting data both ends of a link must implement the same protocol to have intelligible communications http and ftp are two examples of Internet protocols http is the name of the protocol for HTML documents

Automatic documentation with Java Standard Java includes a utility called javadoc that automatically generates documentation files from source code for class definitions Usage: javadoc yourFile.java javadoc produces an HTML document that can be read in a browser it includes selected lines from the source file, e.g. comments and headers javadoc is described in Appendix 4

Displaying a picture Although this chapter does not deal with pictures, here is the HTML command for inserting a picture in a document: For example, if the picture file you want is named mypicture.gif and it is in the images subdirectory of the directory that contains your HTML document: Various picture formats may be used and are generally indicated by the ".xxx" extension in the file name.gif and.jpg are two common ones

Applets Applet: small application Applets are Java programs embedded in HTML documents therefor they run in a browser that views the document They are a derived class of the class Applet, which is derived from Panel therefor it is both a Container and Component Applet class is not in the AWT or basic Java it is in the applet library, so import java.applet.*

Placing applet in the class hierarchy Display 13.4/page 683 Class Abstract Class Key: If there is a line between two classes, then the lower class is a derived class of the higher class. AWT Object Component Container Window Panel Frame Applet

Applet basics When writing applets you will also need the AWT library so you will need the following import statements: import java.applet.*; import java.awt.*; import java.awt.event.*; Applets do not normally have a main method Applets do not normally use constructors but they do use a method named init for similar purposes: setting colors adding buttons adding text fields, etc. the init method has no parameters Th HTML document takes care of sizing the applet Use a layout manager when defining an applet use the setLayout method

Example: a trivial applet FirstApplet.java (Display 13.5/page 684) Applet View Testing 1, 2, 3. Defining an applet

Running an applet from an HTML page The normal way to run an applet is from an HTML document. Syntax: Example: Note:use the compiled file extension.class, not the source extension.java

Testing a java applet Another way to run an applet is usually used just to test it: put the applet in an HTML document good practice is to name the HTML document the same as the applet, but with ".html" instead of ".java" then run it using appletviewer like javadoc, javac, and java, appletviewer comes with the JDK (Java Development Kit) Syntax: appletviewer Applet_File_Name.html Example: appletviewer FirstApplet.html

Another way to test an applet Use the appletviewer in an integrated Java development environment There are many commercial development environments that provide handy tools to write, compile, run and debug Java programs Typically they have a menu selection something like "Run" or "Execute" to run an application usually they will automatically create an applet viewer if you run an applet

Summary HTML is a language for writing documents to be read across the Internet or with a web browser. HTML stands for Hypertext Markup Language. Applets are Java programs designed to be placed in and run from an HTML document. Applets are derived from the class Applet and are similar to AWT GUIs derived from the class Frame.