TAILIEUCHUNG - Java Programming for absolute beginner- P17

Java Programming for absolute beginner- P17:Hello and welcome to Java Programming for the Absolute Beginner. You probably already have a good understanding of how to use your computer. These days it’s hard to find someone who doesn’t, given the importance of computers in today’s world. Learning to control your computer intimately is what will separate you from the pack! By reading this book, you learn how to accomplish just that through the magic of programming. | 2 25 03 8 54 AM Page 278 0 2 0 a c S S s k a o k Q. S s 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 questions 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 modifying the HTML file and without having to rewrite or recompile the applet code. Figure shows the project for this chapter. figure The QuizShow applet asks true or false questions and shows you your score. team Line - live informative Non-cost and Genuine Please purchase PDF Split-Merge on to remove this watermark. 2 25 03 8 54 AM Page 279 279 Understanding Applets 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 browsers interpret the Java to the extent that you will notice a significant difference 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 .