27
Chapter 14 Applets and More

12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Embed Size (px)

Citation preview

Page 1: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Chapter 14Applets and More

Page 2: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

12-2

Chapter TopicsChapter 14 discusses the following main topics:

Introduction to AppletsA Brief Introduction to HTMLCreating Applets with SwingUsing AWT for PortabilityDrawing ShapesHandling Mouse and Key EventsTimer ObjectsPlaying Audio

Page 3: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Introduction to Applets

Page 4: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Introduction to Applets

AppleApplet????

An applet is a Java program that is associated with a Web page and is executed in a Web browser as part

of that Web page

Example: file:///D:/DATA/brasko/users/paulo/Pitt%20University/CS-0401/slides%20from%20Editor/Chapter%2014/TempConverter/TempConverter.html

Page 5: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Introduction to AppletsTwo types of Java programs:

Applications A stand-alone program that runs on your computer

Applets Programs that are part of a Web site that is executed

inside the browser window

Page 6: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Introduction to Applets

AppletWeb Page

Applet

Web Page

Page 7: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Applets and Web Pages: Good Friends

We need to learn a little bit about HTML (web pages) in order to be able to understand the relationship between Applets and

Web Pages

Page 8: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

A Brief Introductionto HTML

Page 9: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

A Good Introduction / hands-on http://www.w3schools.com/html/html_intro.as

p

Page 10: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Adding an Applet into an HTML page

Page 11: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Adding an Applet into an HTML page<!DOCTYPE html><html> <body> <h1>My First Heading</h1> <p>My first paragraph.</p>

<applet width="300" height="300" archive="MyApplet.jar" code="NewJApplet.class"></applet>

</body></html>

Page 12: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Creating an Applet in NetBeans

Page 13: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using
Page 14: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Creating an Applet in NetBeans

Page 15: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Creating an Applet in NetBeans

Page 16: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Creating an Applet in NetBeans

Page 17: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Creating an Applet in NetBeans

Page 18: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using
Page 19: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using
Page 20: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using
Page 21: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using
Page 22: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using
Page 23: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Putting all together:HTML + Applet

Page 24: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Copy the jar and class files

Page 25: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Update Your Web Page

Page 26: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Run the web page fileIn the Windows Explorer, double click on the

html file

Page 27: 12-2 Chapter Topics Chapter 14 discusses the following main topics: Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using

Voilá!!!!