Danh mục

Java Programming for absolute beginner- P17

Số trang: 20      Loại file: pdf      Dung lượng: 435.18 KB      Lượt xem: 11      Lượt tải: 0    
10.10.2023

Xem trước 2 trang đầu tiên của tài liệu này:

Thông tin tài liệu:

Java Programming for absolute beginner- P17:Hello and welcome to Java Programming for the Absolute Beginner. You probablyalready have a good understanding of how to use your computer.These days it’s hard to find someone who doesn’t, given the importanceof computers in today’s world. Learning to control your computer intimatelyis what will separate you from the pack! By reading this book, you learnhow to accomplish just that through the magic of programming.
Nội dung trích xuất từ tài liệu:
Java Programming for absolute beginner- P17 JavaProgAbsBeg-08.qxd 2/25/03 8:54 AM Page 278 278 Java Programming for the Absolute Beginner The Project: QuizShow Applet The QuizShow applet asks a series of true or false questions. The user selects either true or false and then clicks the “That’s my final answer!” button for the next question. The label at the top indicates whether the previous answer was correct. After the user answers the final question, the QuizShow applet shows the final score. The applet is driven by parameters set within the HTML. None of the ques- tions are hard coded in the applet itself. The questions are specified within the HTML parameters, which enable you to ask any number of questions by modify- ing the HTML file and without having to rewrite or recompile the applet code. Figure 8.1 shows the project for this chapter. FIGURE 8.1 The QuizShow applet asks true or false questions and shows you your score. TEAM LinG - Live, Informative, Non-cost and Genuine!Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. JavaProgAbsBeg-08.qxd 2/25/03 8:54 AM Page 279 279 Understanding Applets Chapter 8 An applet is a small program that runs embedded within another application. Popular browsers such as Microsoft Internet Explorer and Netscape Navigator support Java applets. This means that the browsers themselves are interpreting the Java byte code as part of a Web document, not the Java VM that is installed on your system that runs applications. There are often differences in how the Writing Applets browsers interpret the Java to the extent that you will notice a significant differ- ence in how the applets run. Sometimes an applet will run fine in one browser, but not in another. If you experience any difficulty running these applets in your browser, make sure you have the latest version of the Java interpreter, or Virtual Machine (VM), installed. In this chapter, I tested all my applets using the SDK’s appletviewer utility (part of the development kit included on the CD) as well as using Microsoft Internet Explorer 5 with the latest Microsoft VM installed. If you are having trouble with Internet Explorer, from the Tools menu, select Windows Update, where you will be taken to the Windows Update Web site, and look for the Microsoft Virtual Machine update if one is available. If you are using any other browser, visit your browser vendor’s Web site to get more information about the particular browser you are using and its Java support. If all else fails, use the appletviewer utility; it should work just fine. HIN T To use the appletviewer utility in Windows, Solaris, and Linux, at your command prompt type appletviewer myhtmlfile.html, where myhtmlfile.html is the HTML file that has the tags that reference your applet. The appletview- er will show only the applet itself and none of the surrounding HTML. Knowing the Difference between Applets and Applications So far in this book, you’ve dealt almost exclusively with applications. The only exposure you had to an applet was a brief example back in Chapter 1, “Getting Started.” Applications are stand-alone programs because they run on their own and are not interpreted by any program other than your computer’s Java Inter- preter. Applets are found on the Internet and are run by your browser, so they force security restrictions on applets. You wouldn’t want to surf to the wrong Web site and have your hard drive erased, would ...

Tài liệu được xem nhiều:

Tài liệu cùng danh mục:

Tài liệu mới: