{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

ch13 - Chapter 13 APPLETS AND HTML 13.1 HTML 89 HTML Basics...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
87 Chapter 13 A PPLETS AND HTML A PPLETS AND HTML 13.1 HTML 89 HTML Basics 89 Programming Tip A Simple HTML Document Outline 91 Inserting Hyperlinks 92 Gotcha Not Using Your Reload (Refresh) Button 94 Displaying a Picture 96 13.2 A PPLETS 97 Applet Basics 97 Programming Example An Adder Applet 100 Running an Applet 100 Placing an Applet in an HTML Document 103 Programming Tip Converting a Swing Application to an Applet 103 Adding Icons to an Applet 106 Gotcha Using an Old Web Browser 109 The Older Applet Class (Optional) 109 Applets and Security 110 Chapter Summary 111 Answers to Self-Test Questions 111 Programming Exercises 112
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
A PPLETS AND HTML A PPLETS AND HTML The web of our life is of a mingled yarn, good and ill together. W ILLIAM S HAKESPEARE , All’s Well That Ends Well All that has come before this chapter is important to learning how to program and to learning the Java language. However, we have not yet touched on the thing that initially made Java famous. Java became famous in large part due to its connection to the Internet. In this chapter, we describe a version of Java programs that can be run across the Internet. The World Wide Web (Web for short) is the collection of locations on the Internet that you can view with a web browser. Applets are simply Java pro- grams that are designed to run from a document (page) on the Web. HTML is a lan- guage used to create web documents. A Java applet runs from within an HTML document, so we will say a bit about HTML before we discuss applets. Objectives Learn to write a simple HTML document. Find out how to write applets and how to embed an applet in an HTML document. Prerequisites To really get much benefit from this chapter, you should know how to use a web browser such as the Netscape Navigator or Microsoft’s Internet Explorer. All the constructs discussed in this chapter produce things to be viewed via a web browser. We will assume that you have used a web browser to read something on the Web, but will not assume that you know how to create things to be viewed on the Web. Most readers could get sufficient experience by simply playing with a web browser without any instruction or reading. To get the full benefit of this chapter, you should also un- derstand how path names are used on your operating system so that you can name a file that is contained in a different directory (different folder). Section Prerequisite Section 13.1 None Section 13.2 Chapters 1–5, 7, and 12, as well as Section 13.1 web browser
Image of page 2
13.1 HTML 89 13.1 HTML You shall see them on a beautiful quarto page, where a neat rivulet of text shall meander through a meadow of margin. R ICHARD B RINSLEY S HERIDAN , The School for Scandal Documents designed to be read on the Web, or through a web browser whether or not they are on the Web, are typically written in a language called HTML . HTML stands for Hypertext Markup Language. Hypertext is simply text that contains items that you can click with your mouse to go to another document. These connections from document to document are called links , or hyperlinks. The documents them-
Image of page 3

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern