Submit Search
Upload
Eo gaddis java_chapter_13_5e
•
Download as PPT, PDF
•
1 like
•
303 views
G
Gina Bullock
Follow
Chapter 13 Applets and More
Read less
Read more
Education
Report
Share
Report
Share
1 of 57
Download now
Recommended
Eo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5e
Gina Bullock
Eo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5e
Gina Bullock
I pad uicatalog_lesson02
I pad uicatalog_lesson02
Rich Helton
Introduction to Eqela development
Introduction to Eqela development
jobandesther
LEARNING iPAD STORYBOARDS IN OBJ-‐C LESSON 1
LEARNING iPAD STORYBOARDS IN OBJ-‐C LESSON 1
Rich Helton
Graphical User Interface Development with Eqela
Graphical User Interface Development with Eqela
jobandesther
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
European Innovation Academy
Eqela Core API and Utilities
Eqela Core API and Utilities
jobandesther
Recommended
Eo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5e
Gina Bullock
Eo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5e
Gina Bullock
I pad uicatalog_lesson02
I pad uicatalog_lesson02
Rich Helton
Introduction to Eqela development
Introduction to Eqela development
jobandesther
LEARNING iPAD STORYBOARDS IN OBJ-‐C LESSON 1
LEARNING iPAD STORYBOARDS IN OBJ-‐C LESSON 1
Rich Helton
Graphical User Interface Development with Eqela
Graphical User Interface Development with Eqela
jobandesther
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
Coding Lesson (iOS for non-developers) by Zakery Kline and Roger Kerse
European Innovation Academy
Eqela Core API and Utilities
Eqela Core API and Utilities
jobandesther
OSCON Titanium Tutorial
OSCON Titanium Tutorial
Kevin Whinnery
Develop Mobile App Using Android Lollipop
Develop Mobile App Using Android Lollipop
Edureka!
itslearning App Library dag voor partners - Tim Remmers - 12 juni 2012
itslearning App Library dag voor partners - Tim Remmers - 12 juni 2012
itslearning Nederland
Accessibility in Design systems - the pain and glory
Accessibility in Design systems - the pain and glory
Russ Weakley
Learn How to Animate your Android App
Learn How to Animate your Android App
Edureka!
Elixir tutorial
Elixir tutorial
HarikaReddy115
Part1
Part1
Pedro Díaz
Java applets and working principles
Java applets and working principles
DAZZLING DAZZLING
Basic iOS Training with SWIFT - Part 4
Basic iOS Training with SWIFT - Part 4
Manoj Ellappan
Java applet basics
Java applet basics
Sunil Pandey
Design Patterns : Solution to Software Design Problems
Design Patterns : Solution to Software Design Problems
Edureka!
Android app development guide for freshers by ace web academy
Android app development guide for freshers by ace web academy
Ace Web Academy -Career Development Center
What are accessible names and why should you care?
What are accessible names and why should you care?
Russ Weakley
Shibapratim Bagchi HTML tutorial
Shibapratim Bagchi HTML tutorial
Shibapratim Bagchi
New Introductionfor Flash Designers
New Introductionfor Flash Designers
Our Community Exchange LLC
Creating Acessible floating labels
Creating Acessible floating labels
Russ Weakley
Accessible Form Hints and Errors
Accessible Form Hints and Errors
Russ Weakley
Angular material
Angular material
Kalpesh Satasiya
Android development 1july
Android development 1july
Edureka!
Introduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning Simple
Sandeep Hijam
Cso gaddis java_chapter14
Cso gaddis java_chapter14
mlrbrown
Internet programming notes
Internet programming notes
Durgadevi palani
More Related Content
What's hot
OSCON Titanium Tutorial
OSCON Titanium Tutorial
Kevin Whinnery
Develop Mobile App Using Android Lollipop
Develop Mobile App Using Android Lollipop
Edureka!
itslearning App Library dag voor partners - Tim Remmers - 12 juni 2012
itslearning App Library dag voor partners - Tim Remmers - 12 juni 2012
itslearning Nederland
Accessibility in Design systems - the pain and glory
Accessibility in Design systems - the pain and glory
Russ Weakley
Learn How to Animate your Android App
Learn How to Animate your Android App
Edureka!
Elixir tutorial
Elixir tutorial
HarikaReddy115
Part1
Part1
Pedro Díaz
Java applets and working principles
Java applets and working principles
DAZZLING DAZZLING
Basic iOS Training with SWIFT - Part 4
Basic iOS Training with SWIFT - Part 4
Manoj Ellappan
Java applet basics
Java applet basics
Sunil Pandey
Design Patterns : Solution to Software Design Problems
Design Patterns : Solution to Software Design Problems
Edureka!
Android app development guide for freshers by ace web academy
Android app development guide for freshers by ace web academy
Ace Web Academy -Career Development Center
What are accessible names and why should you care?
What are accessible names and why should you care?
Russ Weakley
Shibapratim Bagchi HTML tutorial
Shibapratim Bagchi HTML tutorial
Shibapratim Bagchi
New Introductionfor Flash Designers
New Introductionfor Flash Designers
Our Community Exchange LLC
Creating Acessible floating labels
Creating Acessible floating labels
Russ Weakley
Accessible Form Hints and Errors
Accessible Form Hints and Errors
Russ Weakley
Angular material
Angular material
Kalpesh Satasiya
Android development 1july
Android development 1july
Edureka!
Introduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning Simple
Sandeep Hijam
What's hot
(20)
OSCON Titanium Tutorial
OSCON Titanium Tutorial
Develop Mobile App Using Android Lollipop
Develop Mobile App Using Android Lollipop
itslearning App Library dag voor partners - Tim Remmers - 12 juni 2012
itslearning App Library dag voor partners - Tim Remmers - 12 juni 2012
Accessibility in Design systems - the pain and glory
Accessibility in Design systems - the pain and glory
Learn How to Animate your Android App
Learn How to Animate your Android App
Elixir tutorial
Elixir tutorial
Part1
Part1
Java applets and working principles
Java applets and working principles
Basic iOS Training with SWIFT - Part 4
Basic iOS Training with SWIFT - Part 4
Java applet basics
Java applet basics
Design Patterns : Solution to Software Design Problems
Design Patterns : Solution to Software Design Problems
Android app development guide for freshers by ace web academy
Android app development guide for freshers by ace web academy
What are accessible names and why should you care?
What are accessible names and why should you care?
Shibapratim Bagchi HTML tutorial
Shibapratim Bagchi HTML tutorial
New Introductionfor Flash Designers
New Introductionfor Flash Designers
Creating Acessible floating labels
Creating Acessible floating labels
Accessible Form Hints and Errors
Accessible Form Hints and Errors
Angular material
Angular material
Android development 1july
Android development 1july
Introduction to Docker and Containers- Learning Simple
Introduction to Docker and Containers- Learning Simple
Similar to Eo gaddis java_chapter_13_5e
Cso gaddis java_chapter14
Cso gaddis java_chapter14
mlrbrown
Internet programming notes
Internet programming notes
Durgadevi palani
Vskills certified html designer Notes
Vskills certified html designer Notes
Vskills
Class notes(week 10) on applet programming
Class notes(week 10) on applet programming
Kuntal Bhowmick
What is html xml and xhtml
What is html xml and xhtml
FkdiMl
1 introduction to html
1 introduction to html
myrajendra
Html5
Html5
shkshoaib
Html5
Html5
shkshoaib
Eo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5e
Gina Bullock
HTML practical file
HTML practical file
Kuldeep Sharma
Introduction to asp
Introduction to asp
Materi Kuliah Online
Application Note APLX-LMW-0403: Interfacing the Apache Web ...
Application Note APLX-LMW-0403: Interfacing the Apache Web ...
webhostingguy
Vskills angular js sample material
Vskills angular js sample material
Vskills
Basics java scripts
Basics java scripts
ch samaram
Java script hello world
Java script hello world
sanket kulkarni
HTML.pptx
HTML.pptx
asdfhgjh1
Web engineering 2(lect 0)
Web engineering 2(lect 0)
Roohul Amin
HTML Introduction
HTML Introduction
Hameda Hurmat
Raisa anthony web programming 1st week
Raisa anthony web programming 1st week
Raisa Anjani
The Factors For The Website
The Factors For The Website
Julie May
Similar to Eo gaddis java_chapter_13_5e
(20)
Cso gaddis java_chapter14
Cso gaddis java_chapter14
Internet programming notes
Internet programming notes
Vskills certified html designer Notes
Vskills certified html designer Notes
Class notes(week 10) on applet programming
Class notes(week 10) on applet programming
What is html xml and xhtml
What is html xml and xhtml
1 introduction to html
1 introduction to html
Html5
Html5
Html5
Html5
Eo gaddis java_chapter_14_5e
Eo gaddis java_chapter_14_5e
HTML practical file
HTML practical file
Introduction to asp
Introduction to asp
Application Note APLX-LMW-0403: Interfacing the Apache Web ...
Application Note APLX-LMW-0403: Interfacing the Apache Web ...
Vskills angular js sample material
Vskills angular js sample material
Basics java scripts
Basics java scripts
Java script hello world
Java script hello world
HTML.pptx
HTML.pptx
Web engineering 2(lect 0)
Web engineering 2(lect 0)
HTML Introduction
HTML Introduction
Raisa anthony web programming 1st week
Raisa anthony web programming 1st week
The Factors For The Website
The Factors For The Website
More from Gina Bullock
Eo gaddis java_chapter_10_5e
Eo gaddis java_chapter_10_5e
Gina Bullock
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5e
Gina Bullock
Eo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5e
Gina Bullock
Eo gaddis java_chapter_09_5e
Eo gaddis java_chapter_09_5e
Gina Bullock
Eo gaddis java_chapter_08_5e
Eo gaddis java_chapter_08_5e
Gina Bullock
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5e
Gina Bullock
Eo gaddis java_chapter_05_5e
Eo gaddis java_chapter_05_5e
Gina Bullock
Eo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5e
Gina Bullock
Eo gaddis java_chapter_01_5e
Eo gaddis java_chapter_01_5e
Gina Bullock
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5e
Gina Bullock
Eo gaddis java_chapter_10_5e
Eo gaddis java_chapter_10_5e
Gina Bullock
Eo gaddis java_chapter_07_5e
Eo gaddis java_chapter_07_5e
Gina Bullock
Eo gaddis java_chapter_01_5e
Eo gaddis java_chapter_01_5e
Gina Bullock
Eo gaddis java_chapter_16_5e
Eo gaddis java_chapter_16_5e
Gina Bullock
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5e
Gina Bullock
Eo gaddis java_chapter_09_5e
Eo gaddis java_chapter_09_5e
Gina Bullock
Eo gaddis java_chapter_08_5e
Eo gaddis java_chapter_08_5e
Gina Bullock
Eo gaddis java_chapter_02_5e
Eo gaddis java_chapter_02_5e
Gina Bullock
Eo gaddis java_chapter_05_5e
Eo gaddis java_chapter_05_5e
Gina Bullock
Eo gaddis java_chapter_03_5e
Eo gaddis java_chapter_03_5e
Gina Bullock
More from Gina Bullock
(20)
Eo gaddis java_chapter_10_5e
Eo gaddis java_chapter_10_5e
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_11_5e
Eo gaddis java_chapter_11_5e
Eo gaddis java_chapter_09_5e
Eo gaddis java_chapter_09_5e
Eo gaddis java_chapter_08_5e
Eo gaddis java_chapter_08_5e
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_05_5e
Eo gaddis java_chapter_05_5e
Eo gaddis java_chapter_04_5e
Eo gaddis java_chapter_04_5e
Eo gaddis java_chapter_01_5e
Eo gaddis java_chapter_01_5e
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_06_5e
Eo gaddis java_chapter_10_5e
Eo gaddis java_chapter_10_5e
Eo gaddis java_chapter_07_5e
Eo gaddis java_chapter_07_5e
Eo gaddis java_chapter_01_5e
Eo gaddis java_chapter_01_5e
Eo gaddis java_chapter_16_5e
Eo gaddis java_chapter_16_5e
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_12_5e
Eo gaddis java_chapter_09_5e
Eo gaddis java_chapter_09_5e
Eo gaddis java_chapter_08_5e
Eo gaddis java_chapter_08_5e
Eo gaddis java_chapter_02_5e
Eo gaddis java_chapter_02_5e
Eo gaddis java_chapter_05_5e
Eo gaddis java_chapter_05_5e
Eo gaddis java_chapter_03_5e
Eo gaddis java_chapter_03_5e
Recently uploaded
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
Sarwono Sutikno, Dr.Eng.,CISA,CISSP,CISM,CSX-F
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953056974 Low Rate Call Girls In Saket, Delhi NCR
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
OH TEIK BIN
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
InMediaRes1
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Celine George
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Sapana Sha
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
ssuser54595a
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
Chameera Dedduwage
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
9953056974 Low Rate Call Girls In Saket, Delhi NCR
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
nomboosow
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
eniolaolutunde
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
GaneshChakor2
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
Marc Dusseiller Dusjagr
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
RoyAbrique
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
Sayali Powar
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
akmcokerachita
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
anshu789521
Recently uploaded
(20)
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
Contemporary philippine arts from the regions_PPT_Module_12 [Autosaved] (1).pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
Eo gaddis java_chapter_13_5e
1.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley C HA PT E R 13 Applets and More
2.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Topics Introduction to Applets A Brief Introduction to HTML Creating Applets with Swing Using AWT for Portability Drawing Shapes Handling Mouse Events Timer Objects Playing Audio
3.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Introduction to Applets There are two types of programs you can create with Java: applications applets An application is a stand-alone program that runs on your computer. Applets are Java programs that are usually part of a Web site. If a user opens the Web site with a Java- enabled browser, the applet is executed inside the browser window.
4.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Introduction to Applets It appears to the user that the applet is part of the Web site. Applets are stored on a Web server along with the site’s Web pages. Applets associated with a viewed web page are transmitted to the user’s system. Once the applets are transmitted, the user’s system executes them. Applets can be used to extend the capabilities of a Web page.
5.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Introduction to Applets Web pages are normally written in Hypertext Markup Language (HTML). HTML is static content; whereas, applets are dynamic. An applet does not have to be on a web server in order to be executed. They can be stored on the local computer.
6.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Applet Limitations Applets run on the user’s system, not the server. For security purposes, applets can not: access the local computer file system, run any other program on the user’s system. execute operating system procedures. retrieve information about the user or their system. make network connections with any system except the server from which the applet was transmitted. run anonymously. If an applet displays a window, it will automatically have a message such as “Warning: Applet Window” displayed in it.
7.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Introduction to HTML Hypertext Markup Language (HTML) is the language that Web pages are written in. Hypertext can contain a link to other content on the web page, or another web page. A Markup Language allows you to “mark up” a text file by inserting special instructions. These instructions tell the browser how to format the text and create any hypertext links. To make a web page, create a text file: that contains HTML instructions (known as tags), the text that should be displayed on the Web page, and typically has a .html file extension.
8.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Introduction to HTML This document is called an HTML document. The tags instruct the browser: how to format the text where to place images what to do when the user clicks on a link, etc. Most HTML tags have an opening tag and a closing tag. <tag_name>Text</tag_name> The tags are enclosed in angle brackets (< >). The closing tag is preceded by a forward slash (/).
9.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Document Structure Tags The <html></html> tag marks the beginning and ending of an HTML document. The tag <head></head> marks the document head, a section containing information about the document. The document head contains the <title> </title> tag, which specifies the title of the document. Example: BasicWebPage1.html
10.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Document Structure Tags After the document head comes the <body></body> tag. The document body contains all of the tags and text that produce output in the browser. Example: BasicWebPage2.html
11.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Text Formatting Tags There are many HTML tags that you can use to change the appearance of text. For example, there are six different header tags. <h1></h1> through <h6></h6> A level one header appears in boldface, and is much larger than regular text. A level two header also appears in boldface, but is smaller than a level one header. This pattern continues with the other header tags.
12.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Text Formatting Tags Many tags allow an align attribute to be used to modify where the text shows on the web page: <h1 align="center">Text</h1> <h1 align="left">Text</h1> <h1 align="right">Text</h1> An old way of centering text is to use the <center></center> tag to center a line of text. You can display text: in boldface <b></b>, and italics <i></i> Example: BasicWebPage3.html
13.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Breaks in Text The <br> tag causes a line break to appear at the point in the text where it is inserted. To be XHTML compliant, the <br> tag, and other single element tags, should be written like: <br /> Browsers usually ignore the newline characters that are created when you press the Enter key. The <p>Paragraph Text</p> tag causes a paragraph break. Although not required, the closing tag should be used. A paragraph break typically inserts more space into the text than a line break.
14.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Breaks in Text The <hr> or <hr /> tag causes a horizontal rule to appear at the point in the text where it is inserted. A horizontal rule is a thin, horizontal line that is drawn across the web page. Example: BasicWebPage4.html
15.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley HTML Links A link is some element in a Web page that can be clicked on by the user. The tag that is used to insert a link has the following general format: <a href="Address">Text</a> The Text that appears between the opening and closing tags is the text that will be displayed in the web page. The web resource that is located at Address will be displayed in the browser.
16.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley HTML Links This address is a uniform resource locator (URL). The address is enclosed in quotation marks. Example: <a href="http://www.aw.com/gaddis">Click here to go to the textbook's web site.</a> Example: LinkDemo.html
17.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Creating Applets With Swing Applets are very similar to the GUI applications. Instead of displaying its own window, an applet appears in the browser’s window. The differences between GUI application code and applet code are: A GUI application class is derived from JFrame. An applet class is derived from JApplet. The JApplet class is part of the javax.swing package. A GUI application class has a constructor that creates other components and sets up the GUI. An applet class does not normally have a constructor. Instead, it has a method named init that performs the same operations as a constructor.
18.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Creating Applets With Swing The differences are (continued): The following methods are not called in an applet: super setSize setDefaultCloseOperation pack setVisible No main method is needed to create an Applet object. The browser creates an instance of the class automatically. Example: SimpleApplet.java SimpleApplet.html
19.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Running an Applet The process of running an applet is different from that of running an application. To run an applet, create an HTML document with an applet tag, which has the following general format: <applet code= "Filename.class" width= "width_value" height= "height_value"></applet> Don’t forget the closing angle bracket. Attributes should be enclosed in quotes.
20.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Running an Applet Filename.class is the compiled bytecode of the applet, not the .java file. You can optionally specify a path along with the file name. If you specify only the file name, it is assumed that the file is in the same directory as the HTML The browser: loads specified byte code, and executes it in an area that is the size specified by the "width_value" and "height_value".
21.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Using appletviewer The appletviewer program loads and executes an applet without the need for a Web browser. When running the program, specify the name of an HTML document as a command line argument. appletviewer SimpleApplet.html This command executes any applet referenced by an applet tag in the file SimpleApplet.html. If the document has more than one applet tag, it will execute each applet in a separate window.
22.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Applet Event Handling Events in applets are handled with event listeners exactly as they are in GUI applications. Example: TempConverter.java TempConverter.html
23.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Using AWT for Portability AWT is the original library that has been part of Java since its earliest version. Swing is an improved library that was introduced with Java 2. Some browsers do not directly support the Swing classes in applets. These browsers require a plug-in to run swing applets. This plug-in is automatically installed on a computer when the Java SDK is installed.
24.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Using AWT for Portability Other people running applets might not have the required plug-in. The AWT classes can be used instead of the Swing classes for the components in the applet. The AWT component classes: there is a corresponding AWT class for each of the Swing classes covered so far. The names of the AWT classes names do not start with the letter J. Example: AWTTempConverter.java, TempConverter.html
25.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Drawing Shapes Components have an associated Graphics object that may be used to draw lines and shapes. Java allows drawing of lines and graphical shapes such as rectangles, ovals, and arcs. Frame or panels can become a canvas for your drawings.
26.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley XY Coordinates The location of each pixel in a component is identified with an X coordinate and a Y coordinate. The coordinates are usually written in the form (X, Y). Unlike Cartesian coordinates, the upper-left corner of a drawing area (0, 0). The X coordinates increase from left to right, and the Y coordinates increase from top to bottom. When drawing a line or shape on a component, you must indicate its position using X and Y coordinates.
27.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Graphics Objects Each component has an internal object that is derived from the Graphics class, which is part of the java.awt package. This object has numerous methods for drawing graphical shapes on the surface of the component.
28.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Graphics Objects Some of the methods of the Graphics class: setColor(Color c) Sets the drawing color for this object. getColor() Returns the current drawing color for this object. drawLine(int x1, int y1, int x2, int y2) Draws a line on the component drawRect(int x, int y, int width, int height) Draws the outline of a rectangle on the component. fillOval(int x, int y, int width, int height) Draws a filled oval. drawString(String str, int x, int y) Draws the string passed into str using the current font.
29.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Graphics Objects In order to call these methods, you must get a reference to a component’s Graphics object. One way to do this is to override the paint method. You can override the paint method in any class that is derived from: JApplet JFrame Any AWT class The paint method is responsible for displaying, or “painting,” a component on the screen.
30.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Graphics Objects The paint method is automatically called when the component is first displayed and any time the component needs to be redisplayed. The header for the paint method is: public void paint(Graphics g) The method’s argument is a Graphics object, which is automatically passed by the calling component. Overriding the paint method, allows drawing of graphics on the Graphics object argument. Example: LineDemo.java, LineDemo.html
31.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Graphics Objects The Graphics object argument is responsible for drawing the entire applet window. It is advisable to call the base class paint method passing the Graphics object, g, as an argument: super.paint(g); g.setColor(Color.red); g.drawLine(20, 20, 280, 280); This is a red diagonal line drawn from the top-left area of the applet window to the bottom-right area.
32.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Rectangles Rectangles can be drawn or filled. g.drawRect(10, 10, 50, 50); g.fillRect(10, 10, 50, 50); The fillRect and drawRect take four integers as parameters: drawRect(int x, int y, int width, int height) Example: RectangleDemo.java RectangleDemo.html
33.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Ovals and Bounding Rectangles Ovals are created by drawing the oval inside of a “bounding rectangle”. This rectangle is invisible to the viewer of the Graphics object. g.fillOval(x, y, width, height); (x, y) Width Height Example: OvalDemo.java OvalDemo.html
34.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Arcs • Arcs are drawn from the 90 degree position counterclockwise and can be filled or unfilled. g.drawArc(0, 20, 120, 120, 0, 90); g.fillArc(0, 20, 120, 120, 0, 90); • The fillArc and drawArc take six integers as parameters: drawArc(int x, int y, int width, int height, int start, int end) • Example: – ArcDemo.java – ArcDemo.html
35.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Polygons Polygons are drawn using arrays of integers representing x, y coordinates. int[]xCoords={60,100,140,140,100,60,20,20}; int[]yCoords={20,20,60,100,140,140,100,60};
36.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Polygons The fillPolygon and drawPolygon use the arrays as parameters: Example: PolygonDemo.java PolygonDemo.html
37.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley The repaint Method We do not call a component’s paint method. It is automatically called when the component must be redisplayed. We can force the application or applet to call the paint method. repaint(); The repaint method clears the surface of the component and then calls the paint method.
38.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Drawing on Panels To draw on a panel, get a reference to the panel’s Graphics object and use that object’s methods. The resulting graphics are drawn only on the panel. Getting a reference to a JPanel component’s Graphics object is similar to previous examples. Instead of overriding the JPanel object’s paint method, override its paintComponent method. This is true for all Swing components except JApplet and JFrame.
39.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Drawing on Panels The paintComponent method serves the same purpose as the paint method. When it is called, the component’s Graphics object is passed as an argument. public void paintComponent(Graphics g) When overriding this method, first call the base class’s paintComponent method. super.paintComponent(g);
40.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Drawing on Panels After this you can call any of the Graphics object’s methods to draw on the component. Example: GraphicsWindow.java DrawingPanel.java GraphicsWindow.html
41.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Handling Mouse Events The mouse generates two types of events: mouse events and mouse motion events. Any component derived from the Component class can handle events generated by the mouse. To handle mouse events you create: a mouse listener class and/or a mouse motion listener class.
42.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Handling Mouse Events A mouse listener class can respond to any of the follow events: The mouse button is pressed. The mouse button is released. The mouse button is clicked on (pressed, then released without moving the mouse). The mouse cursor enters a component’s screen space. The mouse cursor exits a component’s screen space. A mouse listener class must implement the MouseListener interface.
43.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Mouse Listener Methods public void mousePressed(MouseEvent e) called if the mouse button is pressed over the component. public void mouseClicked(MouseEvent e) called if the mouse is pressed and released over the component without moving the mouse. public void mouseReleased(MouseEvent e) called when the mouse button is released. public void mouseEntered(MouseEvent e) called when the mouse cursor enters the screen area of the component. public void mouseExited(MouseEvent e) This method is called when the mouse cursor leaves the screen area of the component.
44.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Mouse Events The MouseEvent object contains data about the mouse event. getX and getY are two common methods of the MouseEvent class. They return the X and Y coordinates of the mouse cursor when the event occurs. Once a mouse listener class is created, it can be registered with a component using the addMouseListener method
45.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Mouse Motion Events The appropriate methods in the mouse listener class are automatically called when their corresponding mouse events occur. A mouse motion listener class can respond to the following events: The mouse is dragged The mouse moved. A mouse motion listener class must implement the MouseMotionListener interface and it’s methods.
46.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Mouse Motion Listener Methods public void mouseDragged(MouseEvent e) called when a dragging operation begins over the component. The mousePressed method is always called just before this method. public void mouseMoved(MouseEvent e) called when the mouse cursor is over the component and it is moved. Example: MouseEvents.java MouseEvents.html
47.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Using Adapter Classes The mouse listener class must implement all of the methods required by the interfaces they implement. If any of the methods are omitted, a compiler error results. The MouseAdapter and MouseMotionAdapter classes provide empty implementations of the methods. They can serve as base classes for mouse listener and mouse motion listener classes. Examples: DrawBoxes.java, DrawBoxes.html, DrawBoxes2.java, DrawBoxes2.html
48.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Timer Objects Timer objects automatically generate action events at regular time intervals. This is useful when you want a program to: perform an operation at certain times or after an amount of time has passed. Timer objects are created from the Timer class. The general format of the Timer class’s constructor: Timer(int delay, ActionListener listener)
49.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Timer Objects The delay parameter is the amount of time between action events in milliseconds. The the listener parameter is a reference to an action listener to be registered with the Timer object. Passing null will cause no action listener to be registered. the Timer object’s addActionListener method can register an action listener after the object’s creation.
50.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Timer Object Methods void addActionListener (ActionListener listener) Registers the object referenced by listener as an action listener. int getDelay() Returns the current time delay in milliseconds. boolean isRunning() Returns true if the Timer object is running. void setDelay(int delay) Sets the time delay in milliseconds. void start() Starts the Timer object. void stop() Stops the Timer object.
51.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Timer Object Methods An application can use a Timer object to automatically execute code at regular time intervals. Example: BouncingBall.java BouncingBall.html
52.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Playing Audio Java programs can play audio that is stored in a variety sound file formats. .aif or .aiff (Macintosh Audio File) .au (Sun Audio File) .mid or .rmi (MIDI File) .wav (Windows Wave File) One way to play an audio file is to use the Applet class’s play method. One version of this method is: void play(URL baseLocation, String fileName)
53.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Playing Audio The argument passed to baseLocation is a URL object that specifies the location of the file. The argument passed to fileName is and name of the file. The sound that is recorded in the file is played one time. The getDocumentBase or getCodeBase methods can get a URL object for the first argument.
54.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Playing Audio The getDocumentBase method returns a URL object containing the location of the HTML file that invoked the applet. play(getDocumentBase(), "mysound.wav"); The getCodeBase method returns a URL object containing the location of the applet’s .class file. play(getCodeBase(), "mysound.wav"); If the sound file specified by the arguments to the play method cannot be found, no sound will be played.
55.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Using an AudioClip Object The Applet class’s play method: loads a sound file, plays it one time, and releases it for garbage collection. If you need to load a sound file to be played multiple times, use an AudioClip object. An AudioClip object is an object that implements the AuidoClip interface.
56.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Using an AudioClip Object The AudioClip interface specifies the following three methods: play – plays a sound one time loop – repeatedly plays a sound stop – causes a sound to stop playing The Applet class’s getAudioClip method can be used to create an AudioClip object: AudioClip getAudioClip(URL baseLocation, String fileName) The method returns an AudioClip object that can be used to play the sound file. Example: AudioDemo2.java, AudioDemo2.html
57.
Copyright © 2015
Pearson Education, Inc. Publishing as Pearson Addison-Wesley Playing Audio in an Application • Playing audio in from a JFrame is slightly different than playing audio from an applet. // Create a file object for the step.wav file. File file = new File("step.wav"); // Get a URI object for the audio file. URI uri = file.toURI(); // Get a URL for the audio file. URL url = uri.toURL(); // Get an AudioClip object for the sound // file using the Applet class's static // newAudioClip method. sound = Applet.newAudioClip(url); Example: AudioFrame.java
Download now