Applets, HTML and GUI’s Recitation – 04/11/2008 CS 180 Department of Computer Science, Purdue University.

Slides:



Advertisements
Similar presentations
Learn about Java applets. Know the differences between Java applets and applications. Designing and using Java applets Running Java applets. Security.
Advertisements

HTML Introduction CS 1020 – Lego Robot Design. Building Websites HTML (HyperText Markup Language)  The dominate language of the internet  Describes.
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.
4.01 How Web Pages Work.
MMDE5011 – INTERACTIVE MEDIA PRACTICE 1 WEEK 1: INTRODUCTION TO HTML5
Slides prepared by Rose Williams, Binghamton University Mouse Events + Chapter 17: Applets.
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.
Computer Science 1611 Internet & Web Creating Webpages Hypertext and the HTML Markup Language.
CIS101 Introduction to Computing Week 05. Agenda Your questions CIS101 Survey Introduction to the Internet & HTML Online HTML Resources Using the HTML.
Chapter 12Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Announcements/Reminders l Happy Tax Day! l Project 8 due on Thursday.
Chapter 14 Applets. 2 Knowledge Goals Understand the differing roles of applications and applets Understand how a browser operates Understand the role.
Java Applets. Lecture Objectives Learn about Java applets. Know the differences between Java applets and applications. Designing and using Java applets.
CM143 - Web Week 2 Basic HTML. Links and Image Tags.
Chapter 131 Applets and HTML Chapter Reminders Project 8 due Dec 10:30 pm Project 6 regrades due by midnight tonight –Submit all files (including.
HTML Companion. Lecture Objectives Learn about HTML. Know basic HTML tags.
Topics in this presentation: The Web and how it works Difference between Web pages and web sites Web browsers and Web servers HTML purpose and structure.
Chapter 20 Applets Slides prepared by Rose Williams, Binghamton University Copyright © 2008 Pearson Addison-Wesley. All rights reserved.
Presenting Information on WWW using HTML. Presenting Information on the Web with HTML How Web sites are organized and implemented A brief introduction.
Chapter 16 The World Wide Web Chapter Goals ( ) Compare and contrast the Internet and the World Wide Web Describe general Web processing.
Chapter 13Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 13 l HTML l Applets Applets and HTML.
HTML HTML stands for "Hyper Text Mark-up Language“. Technically, HTML is not a programming language, but rather a markup language. Used to create web pages.
WEB DESIGN USING DREAMWEAVER. The World Wide Web –A Web site is a group of related files organized around a common topic –A Web page is a single file.
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.
Section 4.1 Format HTML tags Identify HTML guidelines Section 4.2 Organize Web site files and folder Use a text editor Use HTML tags and attributes Create.
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.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
JAVA: An Introduction to Problem Solving & Programming, 5 th Ed. By Walter Savitch and Frank Carrano. ISBN © 2009 Pearson Education, Inc., Upper.
Chapter 17: Applets, Images, and Sound. Objectives Learn about applets Write an HTML document to host an applet Use the init() method Work with JApplet.
Just Enough HTML How to Create Basic HTML Documents.
INTRODUCTION. What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML is not a programming language,
Chapter 8 Introduction to HTML and Applets Fundamentals of Java.
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.
Chapter 13. Applets and HTML HTML Applets Computer Programming with JAVA.
Chapter 13Java: an Introduction to Computer Science & Programming - Walter Savitch 1 Chapter 13 l HTML l Applets Applets and HTML.
CPSC 203 Introduction to Computers Lab 33 By Jie Gao.
Lec.10 + (Chapter 8 & 9) GUI Java Applet Jiang (Jen) ZHENG July 6 th, 2005.
4 Chapter Four Introduction to HTML. 4 Chapter Objectives Learn basic HTML commands Discover how to display graphic image objects in Web pages Create.
HTML BTEC National in Computing Section5. Create Information “HTML: defining HTML, discussing HTML uses and demonstrating HTML basics, HTML structure…..
Creating Applets. What is an applet? What is an applet? A Java program that runs in a web browser. A Java program that runs in a web browser. An applet.
4 HTML Basics Section 4.1 Format HTML tags Identify HTML guidelines Section 4.2 Organize Web site files and folder Use a text editor Use HTML tags and.
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.
Applets, Images, and Audio Chapter 14 CSCI CSCI 1302 – Applets, Images, and Audio2 Outline Introduction The Applet Class –The init Method –The start.
HTML Basics. HTML Coding HTML Hypertext markup language The code used to create web pages.
HTML CS 105. Page Structure HTML elements control the details of how a page gets displayed. Every HTML document has the following basic structure: … …
Basic HTML Programming Technology Education Ellsworth Community Middle School Communication Systems.
HTML. INDEX Introduction to HTML Creating Web Pages Commands And Tags Web Page.
1 Applets Programming. Introduction Java programs are divided into two main categories, applets and applications. An application is an ordinary Java program.
Slides prepared by Rose Williams, Binghamton University ICS201 Lecture 17 : Applets King Fahd University of Petroleum & Minerals College of Computer Science.
Chapter 14 Applets. Applets: Introduction Java programs are divided into two main categories, applets and applications An application is an ordinary Java.
4.01 How Web Pages Work.
4.01 How Web Pages Work.
Online PD Basic HTML The Magic Of Web Pages
Chapter 8 Introduction to HTML and Applets
4.01 How Web Pages Work.
Java Applets.
Section 4.1 Section 4.2 Format HTML tags Identify HTML guidelines
Sec (4.3) The World Wide Web.
Introduction to XHTML.
COMPUTING FUNDAMENTALS
Applets and HTML Chapter 13.
Java Applets.
Chapter 13 Applets and HTML HTML Applets.
Chapter 16 The World Wide Web.
4.01 How Web Pages Work.
JAVA APPLET PREPARED BY Mr. Jahanzaib Ahmed
Presentation transcript:

Applets, HTML and GUI’s Recitation – 04/11/2008 CS 180 Department of Computer Science, Purdue University

Announcements Project 8 has been posted.  Develop a Graphical User Interface for the Music Application.  Use posted project 6 solution. Milestone due 16 th April. Final submission due 23 th April.

Introduction HyperText Markup Language (HTML) is the language used to create Web documents. Applets are simply Java programs designed to run from a document (page) on the World Wide Web.

HTML Documents to be read on the Web or using a Web browser typically are expressed in a language called HTML. HTML stands for HyperText Markup Language. Hypertext contains links (or hyperlinks) which permit you to go to other documents. One can place Applets into an HTML document.

HTML, cont. HTML is not a general-purpose programming language like Java. Instead, it is a collection of commands that can produce something that can be viewed using a Web browser. The commands allow you to include pictures and hyperlinks, and allow you to specify headings, subheadings, paragraph beginnings, etc.

HTML Basics Most HTML commands are of the form Some text Example-  Anything between and is centered on the page when it is displayed.  begins a new line.  begins a new paragraph. Commands such as and form a “container” (in this case a table container).  Overloading of the word ‘Container’ between Java and HTML.

HTML : document outline

HTML Basics, cont. The entire document is enclosed between and. The head of the document is enclosed between and.  It might consist only of a title enclosed between and, used to name the document.  The body is enclosed between and and is the real content of the document.

Inserting Hyperlinks, cont. A key element in an HTML document is a link that a person can click to view another document. example CS180 Home The path to document can be either a full path name or a relative path name to a HTML file or a URL to any place on the Web.  Examples-  Details

Displaying a Picture A picture can be inserted into an HTML document using Example OR The picture can be in any directory, but the path name, either full or relative, leading to the picture must be provided.

Applets: Introduction Applets are Java programs that are typically displayed on a Website and viewed over the Internet. An applet can also be run as a stand-alone program on a computer using an applet viewer. An applet is a derived class of class JApplet which is a class in the Swing library.

Applets: Class hierarchy

Applet Basics, cont. A JApplet is a Container, which permits you to add components to it in the same way you add components to a JFrame. Differences from JFrame:  Applets do not use the setVisible method or the setTitle method, nor do they need any size instructions.  Applets are displayed automatically, and do not need to have a main method.  Applets typically do not use constructors. Instead they use method init which serves the same purpose.

Applet Example class HelloApplet

Running an Applet Applets are compiled the same way other Java classes are compiled. The normal way to run an applet is as part of a Web document.  The applet then is viewed using a Web browser. An applet can also be viewed using an applet viewer which is a program designed to run an applet as a stand-alone program.

Adding Icons to an Applet, cont. class DukeApplet

Adding Icons to an Applet, cont. ImageIcon is a class in the Swing library. syntax ImageIcon nameOfImageIcon = new ImageIcon(Picture_File_Name);  Picture_File_Name is a string giving either a relative or absolute path name to the picture file.  The dukeIcon is to the left of the label by default. This can be changed if desired.  Also, an ImageIcon be any size image.

Applets in HTML An Applet can be placed in an HTML Document. To display an applet window, place the following command in an HTML document: (Actually “.class” is optional. code=“AdderApplet” is equivalent to code=“AdderApplet.class” )

Example of Applet placed in HTML DukeIcon! The DukeIcon Home Page Hello out there!! This is a CS180 Applet example <applet code="DukeApplet.class“ width=400 height=200> Like that?

Example, contd.

Quiz G Can you run an applet program from the command line as shown: $ javac DukeApplet.java $ java DukeApplet Why or why not?