How to Create Interactive Web Programs with Java
Excerpted from Sams Teach Yourself Programming with Java in 24 Hours by Rogers Cadenhead. ISBN 0672328445, Copyright © 2006. Used with the permission of Sams Publishing.
Now that Java has made the transition from a child prodigy to an established language, it is being used for all kinds of large-scale business software and other applications. However, for some people, the core appeal of the language remains a type of program that Java made possible: the applet.
Applets are programs designed to run as part of a World Wide Web page. When a Java applet is encountered on a page, it is downloaded to the user’s computer and begins running.
During this hour you’ll be introduced to applet programming and Java Web Start, a way to install and run Java software from within a web browser.
Programming applets with Java is much different from creating applications with Java. Because applets must be downloaded from a page each time they are run, they’re smaller than most applications to reduce download time. Also, because applets run on the computer of the person using the applet, they have numerous security restrictions in place to prevent malicious or damaging code from being run.
The following topics will be covered:
• Displaying information in an applet
• Stopping and starting an applet
• Putting an applet on a web page
• Customizing an applet with parameters on a web page
• Receiving parameters in an applet
• Running applets with the Java Plug-in
Standard Applet Methods
The first step in the creation of an applet is to make it a subclass of JApplet, a class that’s part of the Swing package, javax.swing. An applet is treated as a visual window inside a web page, so JApplet is part of Swing alongside clickable buttons, scrollbars, and other components of a program’s user interface.
JApplet is a subclass of Applet, a class in the java.applet package. Being part of this hierarchy enables the applets you write to use all the behavior and attributes they need to be run as part of a web page. Before you begin writing any other statements in your applets, they will be able to interact with a web browser, load and unload themselves, redraw their window in response to changes in the browser window, and handle other necessary tasks.
In applications, programs begin running with the first statement inside the main()block statement and end with the last closing bracket (}) that closes out the block. There is no main() method in a Java applet, so there is no set starting place for the program. Instead, an applet has a group of standard methods that are handled in response to specific events as the applet runs.
The following are the events that could prompt one of the applet methods to be handled:
• The program is loaded for the first time, which causes the applet’s init() and start() methods to be called.
• Something happens that requires the applet window to be redisplayed, which causes the applet’s paint() method to be called.
• The program is stopped by the browser, which calls the applet’s stop() method.
• The program restarts after a stop, which calls the start() method.
• The program is unloaded as it finishes running, which calls the destroy()method.
The following is an example of a bare-bones applet:
public class Skeleton extends javax.swing.JApplet {
// program will go here
Unlike applications, applet class files must be public because the JApplet class is also public. (If your applet uses other class files of your own creation, they do not have to be declared public.)
Your applet’s class inherits all the methods that are handled automatically when needed: init(), paint(), start(), stop(), and destroy(). However, none of these methods do anything. If you want something to happen in an applet, you have to override these methods with new versions in your applet program.
Painting an Applet Window
The paint() method is used to display text, shapes, and graphics within the applet window. Whenever something needs to be displayed or redisplayed on the applet window, the paint() method handles the task. You also can force paint() to be handled with the following statement in any method of an applet:
Aside from the use of repaint(), the main time the paint() method is handled is when something changes in the browser or the operating system running the browser. For example, if a user minimizes a web page containing an applet, the paint() method will be called to redisplay everything that was onscreen in the applet when the applet is later restored to full size.
Unlike the other methods you will be learning about during this hour, paint()takes an argument. The following is an example of a simple paint() method:
public void paint(Graphics screen) {
Graphics2D screen2D = (Graphics2D)screen;
// display statements go here
The argument sent to the paint() method is a Graphics object. The Graphics class of objects represents an environment in which something can be displayed, such as an applet window. As you did with Swing programs, you may cast this to a Graphics2D object to employ more sophisticated graphical features.
Later this hour, you’ll learn about drawString(), a method for the display of text that’s available in both the Graphics and Graphics2D classes.
If you are using a Graphics or Graphics2D object in your applet, you have to add the following import statements before the class statement at the beginning of the source file:
import java.awt.Graphics;
import java.awt.Graphics2D;

Initializing an Applet
The init() method is handled once—and only once—when the applet is run. As a result, it’s an ideal place to set up values for any objects and variables that are needed for the applet to run successfully. This method is also a good place to set up fonts, colors, and the screen’s background color. Here’s an example:
public void init() {
FlowLayout flo = new FlowLayout();
JButton run = new JButton(“Run”);
If you are going to use a variable in other methods, it should not be created inside an init() method because it will only exist within the scope of that method.
For example, if you create an integer variable called displayRate inside the init()method and try to use it in the paint() method, you’ll get an error when you attempt to compile the program. Create any variables you need to use throughout a class as object variables right after the class statement and before any methods.
Starting and Stopping an Applet
At any point when the applet program starts running, the start() method will be handled. When a program first begins, the init() method is followed by the start() method. After that, in many instances there will never be a cause for the start() method to be handled again. In order for start() to be handled a second time or more, the applet has to stop execution at some point.
The stop() method is called when an applet stops execution. This event can occur when a user leaves the web page containing the applet and continues to another page. It also can occur when the stop() method is called directly in a program.
Destroying an Applet
The destroy() method is an opposite of sorts to the init() method. It is handled just before an applet completely closes down and completes running.
This method is used when something has been changed during a program that should be restored to its original state. It’s another method you’ll use more often with animation than with other types of programs.
Putting an Applet on a Web Page
Applets are placed on a web page in the same way that anything unusual is put on a page: HTML markup tags describe the applet, which a web browser loads along with the other parts of the page. If you have used HTML to create a web page, you know that it’s a way to combine formatted text, images, sound, and other elements together. HTML uses special commands called tags that are surrounded by marks, including img for the display of images, p for the insertion of a paragraph mark, and to center the text that follows until a tag is reached.
The performance of some of these HTML tags can be affected by attributes that determine how they function. For example, src is an attribute of the img tag, and it provides the name of the image file that should be displayed. The following is an example of an img tag:

One way to place applets on a web page is by using an applet tag and several attributes. The following is an example of the HTML required to put an applet on a page:

Sorry, no dice … this requires a Java-enabled browser.

The code attribute identifies the name of the applet’s class file. If more than one class file is being used with an applet, code should refer to the main class file that is a subclass of the JApplet class.
If there is no code attribute, all files associated with the applet should be in the same folder as the web page that loads the program. codebase should contain a reference to the folder or subfolder where the applet and any related files can be found. In the preceding example, codebase indicates that the StripYahtzee applet can be found in the javadir subfolder.
The height and width attributes designate the exact size of the applet window on the web page. It must be big enough to handle the things you are displaying in your applet.
In between the opening tag and the closing tag, you can provide an alternate of some kind for web users whose browser software cannot run Java programs (less than two percent of all web users run browsers that fall into this group).
In the preceding example, the text “Sorry, no dice…this requires a Java-enabled browser” is displayed in place of the applet on a browser such as Lynx, which does not support Java. You can put instructions here on how to download a Java-enabled browser. You also can include hyperlinks and other HTML elements.
Another useful attribute, align, designates how an applet will be displayed in relation to the surrounding material on the page, including text and graphics. The value align=”left” lines up the applet to the left of adjacent page elements and align=”right” lines it up to the right.
A Sample Applet
This hour’s first project is an applet that displays the string “Saluton mondo!”, the traditional Esperanto greeting that is becoming more traditional by the hour. You’ll take a look at how applets are structured by re-creating the Saluton application from Hour 2, “Writing Your First Program,” as a program that can run on a web page.
Load your word processor and create a new file called Enter the text of Listing 17.1 into the file and save it when you’re done.

This applet does not need to use the start(), stop(), or destroy() methods, so they are not included in the program. Compile the program with the javac compiler tool, if you’re an JDK user, or another tool.
home / programming / java_24 / 1

Drawing in An Applet Window
Text is displayed in an applet window by using the drawString() method of the Graphics2D class, which draws text in a graphical user interface component. The drawString() method is similar in function to the System.out.println()method that displays information to the system’s standard output device.
Before you can use the drawString() method, you must have a Graphics or Graphics2D object that represents the applet window.
The paint() method of all applets includes a Graphics object as its only argument, which can be cast to a Graphics2D object:
Graphics2D screen2D = (Graphics2D)screen;
When you have created a Graphics2D object like this, you can call its drawString() method to display text on the area represented by the object.
The following three arguments are sent to drawString():
• The text to display, which can be several different strings and variables strung together with the + operator
• The x position (in an (x,y) coordinate system) where the string should be displayed
• The y position where the string should be displayed
The (x,y) coordinate system in an applet is used with several methods. It begins with the (0,0) point in the upper-left corner of the applet window. Figure 17.1 shows how the (x,y) coordinate system works in conjunction with the statement on Line 12 of

Testing the SalutonApplet Program
Although you have compiled the SalutonApplet program into a class file, you cannot run it using a Java interpreter such as java. If you do, you’ll get an error message looking like this:
Exception in thread “main” java.lang.NoSuchMethodError: main
The error occurs because a Java interpreter runs applications by calling its main() method. Applets don’t include this method. Instead, to run an applet, you need to create a web page that loads the applet. To create a web page, open up a new file on your word processor and call it SalutonApplet.html. Enter Listing 17.2 and then save the file.

All applets you write can be tested with the appletviewer tool that comes with the Java Development Kit. You can see the output of the SalutonApplet applet by typing the following:
appletviewer SalutonApplet.html
One thing to note about appletviewer is that it only runs the applets that are included in a web page, and does not handle any of the other elements such as text and images.
Applets can also be loaded by web browsers, if they are equipped with the Java Plug-in. To attempt this at a command line, type the following command:
You can also choose File, Open from the browser’s menu to find and open the page.
Figure 17.2 shows a screen capture of SalutonApplet loaded in Mozilla Firefox.

If you can’t get this applet to run in Firefox or another web browser, the most likely reason is that the browser needs the Java Plug-in.
The Java Plug-in
Though popular web browsers began including their own Java interpreters with the first release of the language in the mid-’90s, these interpreters failed to keep current.
To make it possible for Java 2 applets to run in current browsers, Sun Microsystems offers the Java Plug-in, a substitute for a browser’s built-in interpreter that supports the most up-to-date version of the language.
A plug-in is a program that works in conjunction with a web browser to expand its functionality. Plug-ins handle a type of data that the browser normally could not handle. Apple offers a plug-in to display QuickTime movies, Macromedia distributes a plug-in to run Flash animation files, and many other kinds of special content are supported in this manner.
If you installed the Java Development Kit, you were given a chance to install the Java Plug-in at the same time.
The Java Plug-in runs Java applets in place of the web browser’s Java interpreter. Once the Java Plug-in is installed, all future Java 2 applets will run automatically if they specify that the Plug-in should be used to run them.
The plug-in is part of the Java Runtime Environment, which can be downloaded at no cost from Sun’s Java site at the address
Sending Parameters from a Web Page
Now that you have had some experience writing computer programs, you might be feeling one of the strongest emotions of the programmer: compiler angst. Even though it takes no more than 15 seconds to compile most programs, that time can seem interminable when you’re debugging a program. Write, save, compile, Aargh—an error! Write, save, compile, Aargh! Write, save, compile, Aargh!… As this vicious cycle repeats itself, it’s easy to become world-weary as a program is compiled and recompiled.
One of the driving forces behind parameter use in Java applets is the fear and loathing of compilation. Parameters enable you to change elements of an applet without editing or recompiling anything. They also make the program more useful.
Parameters are stored as part of the web page that contains an applet. They are created using the HTML tag param and its two attributes: name and value. You can have more than one param tag with an applet, but all of them must be between the opening tag and the closing tag, which also support parameters).
The following is an applet tag that includes several parameters:

This example could be used to send news headlines to an applet that scrolls them across the screen. Because news changes all the time, the only way to create a program of this kind is with parameters.
You use the name attribute to give the parameter a name. This attribute is comparable to giving a variable a name. The value attribute gives the named parameter a value.
Receiving Parameters in the Applet
You have to do something in your Java program to retrieve the parameters on the web page or they will be ignored. The getParameter() method of the JApplet class retrieves a parameter from a param tag on a web page. The parameter name, which is specified with the name attribute on the page, is used as an argument to getParameter(). The following is an example of getParameter() in action:
String display1 = getParameter(“headline1”);
The getParameter() method returns all parameters as strings, so you have to convert them to other types as needed. If you want to use a parameter as an integer, you could use statements such as the following:
int speed;
String speedParam = getParameter(“speed”);
if (speedParam != null) {
speed = Integer.parseInt(speedParam);
This example sets the speed variable by using the speedParam string. You have to test for null strings before setting speed because the parseInt() method cannot work with a null string. When you try to retrieve a parameter with getParameter() that was not included on a web page with the param tag, it will be sent as null, which is the value of an empty string.
Workshop: Handling Parameters in an Applet
The next project you’ll undertake has little practical value, except perhaps as a taunting device. The ShowWeight applet takes a person’s weight and displays it under several different units. The applet takes two parameters: a weight in pounds, and the name of the person who weighs that amount. The weight is used to figure out the person’s weight in ounces, kilograms, and metric tons, all of which are displayed.
Create a new file with your word processor and give it the name Enter Listing 17.3 into the file. Then save and compile the file.

The init() method is where the two parameters are loaded into the applet. Because they come from the web page as strings, they must be converted into the form you need: a floating-point number for the lbs variable, and a string for name.
Converting a string to a floating-point number requires two steps: converting the string to a Float object and then converting that object to a variable of the type float.

Lines 20–22 are used to convert the lbs variable into different units of measure. Each of these statements has (float) in front of the conversion equation. This is used to cast the result of the equation into a floating-point number.
The paint() method of the applet uses the drawString() method of the Graphics2D class to display a line of text onscreen. The paint() method has three arguments: the text to display, and the x and y positions where the text should be shown.
Before you can test the ShowWeight applet, you need to create a web page that contains the applet. Open up a new file on your word processor and name it ShowWeight.html. Enter Listing 17.4 and save it when you’re done.

Use a web browser equipped with the Java Plug-in to see the ShowWeight applet. This demonstration uses Konishiki as its example because the American-born sumo wrestling champion weighs in at more than 605 pounds, making him the largest of these immodest, bikini-wearing behemoths. You can substitute anyone whose weight is either exemplary or well-known. Figure 17.3 shows an example of output from the applet. As you can see, Konishiki’s workout regimen doesn’t include a lot of fatfree SnackWell’s Devil’s Food Cakes.
To make the applet display a different name along with a different value for the weight parameter, all you have to change is the ShowWeight.html file. The applet itself will continue to work correctly.

Java Web Start
One of the issues you must deal with as a Java programmer is how to make your software available to the people who will be using your work.
Applications require a Java interpreter, so one must either be included with the application, or users must install an interpreter themselves. The easiest solution is to require that users download and install the Java Runtime Environment from Sun’s web site at
Regardless of how you deal with the requirement for an interpreter, you distribute an application like any other program, making it available on a CD, website, or some other means. A user must run an installation program to set it up, if one is available, or copy the files and folders manually.
Applets are easier to make available, because they can be run by web browsers. There are several drawbacks to offering applets instead of applications, most importantly the default security policy for applets, which makes it impossible for them to read and write data on a user’s computer, among other restrictions.
Java supports another way to make applications available to users: Java Web Start, a method of downloading and running applications by clicking links on web pages. Java Web Start, which requires the Java Plug-in, offers a way to install and run applications as if they were applets. Here’s how it works:
• A programmer packages an application into a Java Archive file along with a file that uses the Java Network Launching Protocol (JNLP), part of Java Web Start.
• The file is published on a web server along with a web page that links to that file.
• A user loads the page with a browser and clicks the link.
• If the user does not have the Java Runtime Environment, a dialog box opens asking whether it should be downloaded and installed.
• The Java Runtime Environment installs and runs the program, opening new frames and other interface components like any other application. The program is saved in a cache, so it can be run again later without requiring installation.
To see it in action, visit Sun’s Java Web Start site at javawebstart/demos.html. The Web Start Demos page contains pictures of several Java applications, each with a Launch button you can use to run the application, as shown in Figure 17.4.

Click the Launch button of one of the applications. If you don’t have the Java Runtime Environment yet, a dialog box opens asking whether you would like to download and install it.
The runtime environment includes the Java Plug-in, a Java interpreter that adds support for the current version of the language to browsers such as Internet Explorer and Mozilla. The environment can also be used to run applications, whether or not they make use of Java Web Start.
When an application is run using Java Web Start, a title screen will be displayed on your computer briefly and the application’s graphical user interface will appear.
Figure 17.5 shows one of the demo applications offered by Sun, a military strategy game in which three black dots gang up upon a red dot and attempt to keep it from moving into their territory.

As you can see in Figure 17.5, the application looks no different than any of the applications you created during the preceding 16 hours. Unlike applets, which are presented in conjunction with a web page, applications launched with Java Web Start run in their own windows, as if they were run from a command line.

One thing that’s different about a Java Web Start application is the security that can be offered to users. When an application attempts to do some things such as reading and writing files, the user can be asked for permission.
For example, another one of the demo programs is a text editor. When you try to save a file with this application for the first time, the Security Advisory dialog box opens (see Figure 17.6).

If the user does not permit something, the application will be unable to function fully. The kinds of things that would trigger a security dialog are the same things that are not allowed by default in applets: reading and writing files, loading network resources, and the like.
Once an application has been run by Java Web Start, it is stored in a cache, enabling you to run it again later without installation. The only exception is when a new version of the application has become available. In this circumstance, the new version will be downloaded and installed in place of the existing one automatically.
Using Java Web Start
Any Java application can be run using Java Web Start, as long as the web server that will offer the application is configured to work with the technology. To prepare an application to use Java Web Start, you must save the application’s files in a Java Archive (JAR) file, create a special Java Web Start file for the application, and upload the files to the web server.
The special file that must be created uses Java Network Launching Protocol (JNLP), an XML file format that specifies the application’s main class file, its JAR archive, and other things about the program.

The next project you will undertake is to use Java Web Start to launch and run the LottoMadness application from Hour 15, “Responding to User Input.” To get ready, put a copy of that project’s files in your main Java programming folder. The files you need are LottoEvent.class and LottoMadness.class, though you might also want and, in case you decide to make any changes to the application.
The first thing you must do is package all of an application’s class files into a Java Archive (JAR) file along with any other files it needs. If you are using the Software Development Kit, you can create the JAR file with the following command:
jar -cf LottoMadness.jar LottoEvent.class LottoMadness.class
A JAR file called LottoMadness.jar is created that holds both of the class files.
Next you should create an icon graphic for the application, which will be displayed when it is loaded and used as its icon in menus and desktops. The icon can be in either GIF or JPEG format, and should be 64 pixels wide and 64 pixels tall.
For this project, if you don’t want to create a new icon, you can download lottobigicon.gif from the book’s website. Go to and open the Hour 17 page. Right-click the lottobigicon.gif link and save the file to the same folder as your LottoMadness.jar file.
The final thing you must do is to create the JNLP file that describes the application. Listing 17.5 contains a JNLP file used to distribute the LottoMadness application. Open your word processor and enter the text of this listing, then save the file as LottoMadness.jnlp.

The structure of a JNLP file is similar to the HTML markup required to put a Java applet on a web page. Everything within marks is a tag, and tags are placed around the information the tag describes. There’s an opening tag before the information and a closing tag after it.
For example, Line 7 of Listing 17.5 contains the following text:

In order from left to right, this line contains the opening tag . The text between the tags—LottoMadness Application— is the title of the application, which will be displayed when it is loaded and used in menus and shortcuts.

How to Create Interactive Web Programs with Java
Excerpted from Sams Teach Yourself Programming with Java in 24 Hours by Rogers Cadenhead. ISBN 0672328445, Copyright © 2006. Used with the permission of Sams Publishing.
The difference between opening tags and closing tags is that closing tags begin with a slash (/) character and opening tags do not. In Line 8, is the opening tag, is the closing tag, and these tags surround the name of the vendor who created the application. Place your own name within these tags, taking care not to alter the or tags around it.
Some tags have an opening tag only, such as Line 11:

The tag indicates that the application can be run even if the user is not connected to the Internet. If it was omitted from the JNLP file, the opposite would be true, and the user would be forced to go online before running this application.
In XML, all tags that do not have a closing tag end with /> instead of >.
Tags also can have attributes, which are another way to define information in an XML file. An attribute is a word inside a tag that is followed by an equals sign and some text within quotes.
For example, consider Line 9 of Listing 17.5:

This is the tag, and it has one attribute, href. The text between the quote marks is used to set the value of this attribute to This defines the home page of the application—the web page that users should visit if they want to read more information about the program and how it works.
The LottoMadness JNLP file defines a simple Java Web Start application that does not make use of any Java features that require special permission.
In addition to the tags that have already been described, Listing 17.5 defines other information required by Java Web Start.
Line 1 designates that the file uses XML and the UTF-8 character set. This same line can be used on any of the JNLP files you create for applications.
Line 2 is a comment. Like other comments in Java, it’s placed in the file solely for the benefit of humans. Java Web Start will ignore it.
Lines 3–5 indicate where the JNLP file for this application can be found. The codebase attribute in Line 4 is the URL of the folder that contains the JNLP file. The href attribute in Line 5 is the name of the file. These lines indicate that the file is at the web address LottoMadness.jnlp.
Lines 6 and 12 use the and tags to surround information about the application. Tags can contain other tags in XML: This tag contains , , , , and tags.<br /> Line 10 indicates the location of the program’s icon, which uses the codebase attribute described previously. In this example, the file is at the web address http:// <a href="" rel="nofollow"></a>.<br /> Lines 13 and 16 use the and tags to surround information about resources used by the application.<br /> Line 14 indicates the version of the Java interpreter that should run the application: 1.5, which sets up the application to use Java 2 version 5 (which has the internal version number 1.5)<br /> Line 15 indicates the application’s JAR file. This also uses codebase, so this file is in <a href="" rel="nofollow"></a>.<br /> Line 17 indicates which class file should be run to start the application: LottoMadness. Note that the .class file extension is not specified—only the name of the class itself.<br /> Line 18 ends the definition of this JNLP file. All JNLP files must be contained within an opening tag and a closing tag.<br /> After you have created this file, change Line 4 of Listing 17.5 so that it refers to the folder on a web server where your application’s JAR file, icon file, and JNLP file will be stored.<br /> Upload all three of the files to this folder, then run your browser and load the JNLP file using its full web address. If your web server is configured to support Java Web Start, the application will be loaded and begin running, as in Figure 17.7.<br /> If your server does not support Java Web Start, which is more likely than not because it is a relatively new technology, you may see the text of your JNLP file loaded in a page and the application will not open.</p> <p>A web server must be configured to recognize that JNLP files are a new type of data that should be run as an application, not delivered to the user as text in a browser window. On an Apache web server, the server administrator can support JNLP by adding the following line to the server’s mime-types (or .mime-types) file:<br /> application/x-java-jnlp-file JNLP</p> <p>Summary<br /> Most of the hours in this book focus on applications, primarily because most Java programmers today don’t do a lot of work designing applets for the World Wide Web.<br /> Writing applets is a good way for beginners to develop their skills as Java programmers for the following reasons:<br /> • Applets are usually smaller in scope, making their creation a less daunting task.<br /> • You can find thousands of sample applets on the World Wide Web, including many with the source file available from which to learn.<br /> • You can make applets available to a global audience at low to no cost through the Web, exposing your work to more people who can offer comments and suggestions.<br /> Q&A<br /> Q Is there a reason why the codebase attribute should be used in an applet tag?<br /> A If all Java programs are grouped into their own subfolder, as indicated by codebase, this structure might improve the way a website is organized, but there’s no other reason why using codebase is better than omitting it. The choice is a matter of personal preference.<br /> Q What happens if the height and width specified for an applet don’t leave enough room for the information that is displayed in the paint() method?<br /> A The information will be drawn off-screen, beyond the edges of the applet window, and won’t be visible at any point while the applet runs. Choosing the right dimensions for an applet is largely a matter of trial-and-error until you find the right size for both the height and width attributes of the applet tag. You can’t resize an applet window from within a Java program, so the only way to control its size is by using the height and width attributes. Fortunately, you can change the web page’s HTML without having to recompile the Java program.<br /> Q What is the Peter Principle?<br /> A The principle was an idea popularized in the book The Peter Principle: Why Things Always Go Wrong by Laurence Peter with Raymond Hull.<br /> Peter, a Canadian-born author, psychologist and professor, put forth the following principle: In the workplace, every employee rises to his own level of incompetence.<br /> If an employee does a good job, he is repeatedly promoted until he eventually reaches a level where he cannot do the work—and is no longer promoted.<br /> I was promoted to write computer books in 1996 and have remained in the position for nine years.<br /> Quiz<br /> The following questions test your knowledge of applets.<br /> Questions<br /> 1. What type of argument is used with the paint() method?<br /> • a. A Graphics object<br /> • b. A Graphics2D object<br /> • c. None<br /> 2. Which method is handled right before an applet finishes running?<br /> • a. decline()<br /> • b. destroy()<br /> • c. defenestrate()<br /> 3. Why can’t all variables needed in an applet be created inside the init() method?<br /> • a. The scope of the variables would be limited to the method only.<br /> • b. Federal legislation prohibits it.<br /> • c. They can be created there without any problems.<br /> Answers<br /> 1. a. The Graphics object keeps track of the behavior and attributes needed to display things on-screen in the applet window. You might create a Graphics2 object inside the method, but it isn’t sent as an argument.<br /> 2. b.<br /> 3. a. Variables that are used in more than one method of a class should be created right after the class statement but before any methods begin.<br /> Activities<br /> You can apply your applet programming knowledge with the following activities:<br /> • Write an applet in which the text that is displayed moves each time the applet window is repainted.<br /> • Install the Java Plug-in with your preferred browser, if you’re on a Windows or Solaris system, and try the sample applets provided from Sun’s Java Plug-in page.<br /> To see a Java program that implements the first activity, visit the book’s website at <a href="" rel="nofollow"></a>.<br /> Excerpted from Sams Teach Yourself Programming with Java in 24 Hours by Rogers Cadenhead. ISBN 0672328445, Copyright © 2006. Used with the permission of Sams Publishing.</p> <div class="wpcnt"> <div class="wpa wpmrec"> <a class="wpa-about" href="" rel="nofollow"></a> <div id="crt-541787258" style="width:300px;height:250px;"></div> <script type="text/javascript"> var o = document.getElementById('crt-541787258'); if ("undefined"!=typeof Criteo) { var p = o.parentNode;'display', 'inline-block', 'important');'display', 'block', 'important'); Criteo.DisplayAcceptableAdIfAdblocked({zoneid:388248,containerid:"crt-541787258",collapseContainerIfNotAdblocked:true,"callifnotadblocked": function () {var o = document.getElementById('crt-541787258');'display','none','important');'visbility','hidden','important'); } }); } else {'display', 'none', 'important');'visibility', 'hidden', 'important'); } </script> <div class="u"> <script type='text/javascript'> (function(g){if("undefined"!=typeof g.__ATA){g.__ATA.initAd({sectionId:26942, width:300, height:250});}})(window); </script> </div> </div> </div><div id="jp-post-flair" class="sharedaddy sharedaddy-dark sd-like-enabled sd-sharing-enabled"><div class="sharedaddy sd-sharing-enabled"><div class="robots-nocontent sd-block sd-social sd-social-icon-text sd-sharing"><h3 class="sd-title">Share this:</h3><div class="sd-content"><ul><li class="share-email"><a rel="nofollow" data-shared="" class="share-email sd-button share-icon" href="" target="_blank" title="Click to email"><span>Email</span></a></li><li class="share-facebook"><a rel="nofollow" data-shared="sharing-facebook-77" class="share-facebook sd-button share-icon" href="" target="_blank" title="Share on Facebook"><span>Facebook</span></a></li><li class="share-twitter"><a rel="nofollow" data-shared="sharing-twitter-77" class="share-twitter sd-button share-icon" href="" target="_blank" title="Click to share on Twitter"><span>Twitter</span></a></li><li class="share-print"><a rel="nofollow" data-shared="" class="share-print sd-button share-icon" href="" target="_blank" title="Click to print"><span>Print</span></a></li><li class="share-reddit"><a rel="nofollow" data-shared="" class="share-reddit sd-button share-icon" href="" target="_blank" title="Click to share on Reddit"><span>Reddit</span></a></li><li class="share-custom share-custom-facebook"><a rel="nofollow" data-shared="" class="share-custom share-custom-facebook sd-button share-icon" href="" target="_blank" title="Click to share on facebook"><span style="background-image:url("");">facebook</span></a></li><li class="share-end"></li></ul></div></div></div><div class='sharedaddy sd-block sd-like jetpack-likes-widget-wrapper jetpack-likes-widget-unloaded' id='like-post-wrapper-16784990-77-58837ad497e0f' data-src='//' data-name='like-post-frame-16784990-77-58837ad497e0f'><h3 class='sd-title'>Like this:</h3><div class='likes-widget-placeholder post-likes-widget-placeholder' style='height: 55px;'><span class='button'><span>Like</span></span> <span class="loading">Loading...</span></div><span class='sd-text-color'></span><a class='sd-link-color'></a></div> <div id='jp-relatedposts' class='jp-relatedposts' > <h3 class="jp-relatedposts-headline"><em>Related</em></h3> </div></div> <div class="linkpages"></div> </div> <small></small> <div class="postmetabottom"> <div class="tags"></div> <div class="readmore"><a href="">Comments <abbr title="Really Simple Syndication">RSS</abbr> feed</a></div> </div> </div><!-- /post --> <div id="comments"> <div id="respond" class="comment-respond"> <h3 id="reply-title" class="comment-reply-title">Leave a Reply <small><a rel="nofollow" id="cancel-comment-reply-link" href="/2010/11/27/how-to-create-interactive-web-programs-with-java/#respond" style="display:none;">Cancel reply</a></small></h3> <form action="" method="post" id="commentform" class="comment-form"> <input type="hidden" id="highlander_comment_nonce" name="highlander_comment_nonce" value="12ffd8a33f" /><input type="hidden" name="_wp_http_referer" value="/2010/11/27/how-to-create-interactive-web-programs-with-java/" /> <input type="hidden" name="hc_post_as" id="hc_post_as" value="guest" /> <div class="comment-form-field comment-textarea"> <label for="comment">Enter your comment here...</label> <div id="comment-form-comment"><textarea id="comment" name="comment" title="Enter your comment here..."></textarea></div> </div> <div id="comment-form-identity"> <div id="comment-form-nascar"> <p>Fill in your details below or click an icon to log in:</p> <ul> <li class="selected" style="display:none;"> <a href="#comment-form-guest" id="postas-guest" title="Guest"> <span></span> </a> </li> <li> <a href="" id="postas-wordpress" title=""> <span></span> </a> </li> <li> <a href="#comment-form-load-service:Twitter" id="postas-twitter" title="Twitter"> <span></span> </a> </li> <li> <a href="#comment-form-load-service:Facebook" id="postas-facebook" title="Facebook"> <span></span> </a> </li> <li> <iframe id="googleplus-sign-in" name="googleplus-sign-in" src="" width="24" height="24" scrolling="no" allowtransparency="true" seamless="seamless" frameborder="0"></iframe> </li> </ul> </div> <div id="comment-form-guest" class="comment-form-service selected"> <div class="comment-form-padder"> <div class="comment-form-avatar"> <a href="" target="_blank"> <img src="" alt="Gravatar" width="25" class="no-grav" /> </a> </div> <div class="comment-form-fields"> <div class="comment-form-field comment-form-email"> <label for="email">Email <span class="required">(required)</span> <span class="nopublish">(Address never made public)</span></label> <div class="comment-form-input"><input id="email" name="email" type="email" value="" /></div> </div> <div class="comment-form-field comment-form-author"> <label for="author">Name <span class="required">(required)</span></label> <div class="comment-form-input"><input id="author" name="author" type="text" value="" /></div> </div> <div class="comment-form-field comment-form-url"> <label for="url">Website</label> <div class="comment-form-input"><input id="url" name="url" type="url" value="" /></div> </div> </div> </div> </div> <div id="comment-form-wordpress" class="comment-form-service"> <div class="comment-form-padder"> <div class="comment-form-avatar"> <img src="" alt=" Logo" width="25" class="no-grav" /> </div> <div class="comment-form-fields"> <input type="hidden" name="wp_avatar" id="wordpress-avatar" class="comment-meta-wordpress" value="" /> <input type="hidden" name="wp_user_id" id="wordpress-user_id" class="comment-meta-wordpress" value="" /> <input type="hidden" name="wp_access_token" id="wordpress-access_token" class="comment-meta-wordpress" value="" /> <p class="comment-form-posting-as pa-wordpress"><strong></strong> You are commenting using your account. <span class="comment-form-log-out">( <a href="javascript:HighlanderComments.doExternalLogout( 'wordpress' );">Log Out</a> / <a href="#" onclick="javascript:HighlanderComments.switchAccount();return false;">Change</a> )</span></p> </div> </div> </div> <div id="comment-form-twitter" class="comment-form-service"> <div class="comment-form-padder"> <div class="comment-form-avatar"> <img src="" alt="Twitter picture" width="25" class="no-grav" /> </div> <div class="comment-form-fields"> <input type="hidden" name="twitter_avatar" id="twitter-avatar" class="comment-meta-twitter" value="" /> <input type="hidden" name="twitter_user_id" id="twitter-user_id" class="comment-meta-twitter" value="" /> <input type="hidden" name="twitter_access_token" id="twitter-access_token" class="comment-meta-twitter" value="" /> <p class="comment-form-posting-as pa-twitter"><strong></strong> You are commenting using your Twitter account. <span class="comment-form-log-out">( <a href="javascript:HighlanderComments.doExternalLogout( 'twitter' );">Log Out</a> / <a href="#" onclick="javascript:HighlanderComments.switchAccount();return false;">Change</a> )</span></p> </div> </div> </div> <div id="comment-form-facebook" class="comment-form-service"> <div class="comment-form-padder"> <div class="comment-form-avatar"> <img src="" alt="Facebook photo" width="25" class="no-grav" /> </div> <div class="comment-form-fields"> <input type="hidden" name="fb_avatar" id="facebook-avatar" class="comment-meta-facebook" value="" /> <input type="hidden" name="fb_user_id" id="facebook-user_id" class="comment-meta-facebook" value="" /> <input type="hidden" name="fb_access_token" id="facebook-access_token" class="comment-meta-facebook" value="" /> <p class="comment-form-posting-as pa-facebook"><strong></strong> You are commenting using your Facebook account. <span class="comment-form-log-out">( <a href="javascript:HighlanderComments.doExternalLogout( 'facebook' );">Log Out</a> / <a href="#" onclick="javascript:HighlanderComments.switchAccount();return false;">Change</a> )</span></p> </div> </div> </div> <div id="comment-form-googleplus" class="comment-form-service"> <div class="comment-form-padder"> <div class="comment-form-avatar"> <img src="" alt="Google+ photo" width="25" class="no-grav" /> </div> <div class="comment-form-fields"> <input type="hidden" name="googleplus_avatar" id="googleplus-avatar" class="comment-meta-googleplus" value="" /> <input type="hidden" name="googleplus_user_id" id="googleplus-user_id" class="comment-meta-googleplus" value="" /> <input type="hidden" name="googleplus_access_token" id="googleplus-access_token" class="comment-meta-googleplus" value="" /> <p class="comment-form-posting-as pa-googleplus"><strong></strong> You are commenting using your Google+ account. <span class="comment-form-log-out">( <a href="javascript:HighlanderComments.doExternalLogout( 'googleplus' );">Log Out</a> / <a href="#" onclick="javascript:HighlanderComments.switchAccount();return false;">Change</a> )</span></p> </div> </div> </div> <div id="comment-form-load-service" class="comment-form-service"> <div class="comment-form-posting-as-cancel"><a href="javascript:HighlanderComments.cancelExternalWindow();">Cancel</a></div> <p>Connecting to %s</p> </div> </div> <script type="text/javascript"> var highlander_expando_javascript = function(){ var input = document.createElement( 'input' ), comment = jQuery( '#comment' ); if ( 'placeholder' in input ) { comment.attr( 'placeholder', jQuery( '.comment-textarea label' ).remove().text() ); } // Expando Mode: start small, then auto-resize on first click + text length jQuery( '#comment-form-identity' ).hide(); jQuery( '#comment-form-subscribe' ).hide(); jQuery( '#commentform .form-submit' ).hide(); comment.css( { 'height':'10px' } ).one( 'focus', function() { var timer = setInterval( HighlanderComments.resizeCallback, 10 ) jQuery( this ).animate( { 'height': HighlanderComments.initialHeight } ).delay( 100 ).queue( function(n) { clearInterval( timer ); HighlanderComments.resizeCallback(); n(); } ); jQuery( '#comment-form-identity' ).slideDown(); jQuery( '#comment-form-subscribe' ).slideDown(); jQuery( '#commentform .form-submit' ).slideDown(); }); } jQuery(document).ready( highlander_expando_javascript ); </script> <div id="comment-form-subscribe"> <p class="comment-subscription-form"><input type="checkbox" name="subscribe" id="subscribe" value="subscribe" style="width: auto;"/> <label class="subscribe-label" id="subscribe-label" for="subscribe" style="display: inline;">Notify me of new comments via email.</label></p></div> <p class="form-submit"><input name="submit" type="submit" id="comment-submit" class="submit" value="Post Comment" /> <input type='hidden' name='comment_post_ID' value='77' id='comment_post_ID' /> <input type='hidden' name='comment_parent' id='comment_parent' value='0' /> </p><p style="display: none;"><input type="hidden" id="akismet_comment_nonce" name="akismet_comment_nonce" value="2258a20413" /></p> <input type="hidden" name="genseq" value="1485011668" /> <p style="display: none;"><input type="hidden" id="ak_js" name="ak_js" value="14"/></p> </form> </div><!-- #respond --> <div style="clear: both"></div> </div><!-- /comments --> <div id="navigation"> <div class="alignleft">« <a href="" rel="prev">THE LIFE AND TIME OF MICHEAL JACKSON (1958-2009)</a></div> <div class="alignright"></div> </div><!-- /navigation --> </div><!-- /content --> <div id="sidebar"> <ul> <li class="boxed"> <h3>Recent entries</h3> <ul> <li><a href=''>How to Create Interactive Web Programs with Java</a></li> <li><a href=''>THE LIFE AND TIME OF MICHEAL JACKSON (1958-2009)</a></li> <li><a href=''>THE GENESIS OF THE WORLD PART 1</a></li> <li><a href=''>What is the oldest living thing on earth? Who has the secrets to longevity?</a></li> <li><a href=''>College Girls Drinking More and Wearing Less & GIRL BORN WITH 4 ARMS, 4 LEGS HAS SUCCESSFUL SURGERY</a></li> <li><a href=''>NEW JOB HAS ARRIVE NOW, SEE PUNCH FOR MORE DETAILS</a></li> <li><a href=''>What Would You Do If Your Mum Walks Your Girlfriend Out Of Your Flat ?</a></li> <li><a href=''>IFEANYI HOOKS UCHE</a></li> <li><a href=''>I Beg My Husband For Sex —housewife</a></li> <li><a href=''>PICTURE OF MY FACEBOOK FRIENDS ON TELLEME</a></li> </ul> </li> <li class="boxed" id="tagbox"> <h3>Browse popular tags</h3> </li> <li class="boxed"> <h3>Meta</h3> <ul> <li><a href="">Register</a></li> <li><a href="">Log in</a></li> <li><a href="">Entries RSS</a></li> <li><a href="">Comments RSS</a></li> </ul> </li> </ul> </div><!-- /sidebar --> </div><!-- /main --> <div id="footer"> <div class="foot1"> <ul> <li> <h3>Friends & links</h3> <ul> <li><a href="">Documentation</a></li> <li><a href="">Plugins</a></li> <li><a href="">Suggest Ideas</a></li> <li><a href="">Support Forum</a></li> <li><a href="">Themes</a></li> <li><a href="">WordPress Blog</a></li> <li><a href="">WordPress Planet</a></li> </ul> </li> </ul> </div> <div class="foot2"> <ul> <li> <h3>Pages</h3> <ul> <li class="page_item page-item-2"><a href="">About</a></li> </ul> </li> </ul> </div> <div class="foot3"> <ul> <li> <h3>Monthly archives</h3> <ul> <li><a href=''>November 2010</a></li> <li><a href=''>October 2010</a></li> </ul> </li> </ul> </div> </div><!-- /footer --> <div id="credits"> <div id="creditsleft"><a href="">Blog at</a></div> <div id="creditsright"><a href="#top">[ Back to top ]</a></div> </div><!-- /credits --> </div><!-- /wrapper --> <!-- --> <script type='text/javascript' src='//'></script> <script type='text/javascript'> /* <![CDATA[ */ var WPGroHo = {"my_hash":""}; /* ]]> */ </script> <script type='text/javascript' src=''></script> <script> //initialize and attach hovercards to all gravatars jQuery( document ).ready( function( $ ) { if (typeof Gravatar === "undefined"){ return; } if ( typeof Gravatar.init !== "function" ) { return; } Gravatar.profile_cb = function( hash, id ) { WPGroHo.syncProfileData( hash, id ); }; Gravatar.my_hash = WPGroHo.my_hash; Gravatar.init( 'body', '#wp-admin-bar-my-account' ); }); </script> <div style="display:none"> </div> <script type='text/javascript'> /* <![CDATA[ */ var HighlanderComments = {"loggingInText":"Logging In\u2026","submittingText":"Posting Comment\u2026","postCommentText":"Post Comment","connectingToText":"Connecting to %s","commentingAsText":"%1$s: You are commenting using your %2$s account.","logoutText":"Log Out","loginText":"Log In","connectURL":"https:\/\/\/public.api\/connect\/?action=request","logoutURL":"https:\/\/\/wp-login.php?action=logout&_wpnonce=3cb3922f76","homeURL":"https:\/\/\/","postID":"77","gravDefault":"identicon","enterACommentError":"Please enter a comment","enterEmailError":"Please enter your email address here","invalidEmailError":"Invalid email address","enterAuthorError":"Please enter your name here","gravatarFromEmail":"This picture will show whenever you leave a comment. Click to customize it.","logInToExternalAccount":"Log in to use details from one of these accounts.","change":"Change","changeAccount":"Change Account","comment_registration":"0","userIsLoggedIn":"","isJetpack":"0","text_direction":"ltr"}; /* ]]> */ </script> <script type='text/javascript' src=',/wp-content/mu-plugins/highlander-comments/script.js?m=1479964158j'></script> <script type="text/javascript"> window.WPCOM_sharing_counts = {"https:\/\/\/2010\/11\/27\/how-to-create-interactive-web-programs-with-java\/":77}; </script> <div id="sharing_email" style="display: none;"> <form action="/2010/11/27/how-to-create-interactive-web-programs-with-java/" method="post"> <label for="target_email">Send to Email Address</label> <input type="email" name="target_email" id="target_email" value="" /> <label for="source_name">Your Name</label> <input type="text" name="source_name" id="source_name" value="" /> <label for="source_email">Your Email Address</label> <input type="email" name="source_email" id="source_email" value="" /> <input type="text" id="jetpack-source_f_name" name="source_f_name" class="input" value="" size="25" autocomplete="off" /> <script> document.getElementById('jetpack-source_f_name').value = ''; </script> <div class="recaptcha" id="sharing_recaptcha"></div><input type="hidden" name="recaptcha_public_key" id="recaptcha_public_key" value="6LcYW8MSAAAAADBAuEH9yaPcF7lWh11Iq62ZKtoo" /> <img style="float: right; display: none" class="loading" src="" alt="loading" width="16" height="16" /> <input type="submit" value="Send Email" class="sharing_send" /> <a rel="nofollow" href="#cancel" class="sharing_cancel">Cancel</a> <div class="errors errors-1" style="display: none;"> Post was not sent - check your email addresses! </div> <div class="errors errors-2" style="display: none;"> Email check failed, please try again </div> <div class="errors errors-3" style="display: none;"> Sorry, your blog cannot share posts by email. </div> </form> </div> <script type="text/javascript"> var windowOpen; jQuery(document).on( 'ready post-load', function(){ jQuery( 'a.share-facebook' ).on( 'click', function() { if ( 'undefined' !== typeof windowOpen ){ // If there's another sharing window open, close it. windowOpen.close(); } windowOpen = jQuery(this).attr( 'href' ), 'wpcomfacebook', 'menubar=1,resizable=1,width=600,height=400' ); return false; }); }); </script> <script type="text/javascript"> var windowOpen; jQuery(document).on( 'ready post-load', function(){ jQuery( 'a.share-twitter' ).on( 'click', function() { if ( 'undefined' !== typeof windowOpen ){ // If there's another sharing window open, close it. windowOpen.close(); } windowOpen = jQuery(this).attr( 'href' ), 'wpcomtwitter', 'menubar=1,resizable=1,width=600,height=350' ); return false; }); }); </script> <script type='text/javascript' src=''></script> <script type='text/javascript'> /* <![CDATA[ */ var actionbardata = {"siteID":"16784990","siteName":"Telleme.Com","siteURL":"http:\/\/","icon":"<img alt='' src='https:\/\/\/i\/logo\/wpcom-gray-white.png' class='avatar avatar-50' height='50' width='50' \/>","canManageOptions":"","canCustomizeSite":"","isFollowing":"","themeSlug":"pub\/motion","signupURL":"https:\/\/\/start\/","loginURL":"https:\/\/\/wp-login.php?","themeURL":"","xhrURL":"https:\/\/\/wp-admin\/admin-ajax.php","nonce":"d7de47fa67","isSingular":"1","isFolded":"","isLoggedIn":"","isMobile":"","subscribeNonce":"<input type=\"hidden\" id=\"_wpnonce\" name=\"_wpnonce\" value=\"86a187f621\" \/>","referer":"https:\/\/\/2010\/11\/27\/how-to-create-interactive-web-programs-with-java\/","canFollow":"1","statusMessage":"","customizeLink":"https:\/\/\/wp-admin\/customize.php?","postID":"77","shortlink":"http:\/\/\/p18qxE-1f","canEditPost":"","editLink":"https:\/\/\/post\/\/77","statsLink":"https:\/\/\/stats\/post\/77\/","i18n":{"view":"View site","follow":"Follow","following":"Following","edit":"Edit","login":"Log in","signup":"Sign up","customize":"Customize","report":"Report this content","themeInfo":"Get theme: Motion","shortlink":"Copy shortlink","copied":"Copied","followedText":"New posts from this site will now appear in your <a href=\"https:\/\/\/\">Reader<\/a>","foldBar":"Collapse this bar","unfoldBar":"Expand this bar","editFollows":"Manage sites I follow","editSubs":"Manage subscriptions","viewReader":"View site in the Reader","subscribe":"Sign me up","enterEmail":"Enter your email address","followers":"","alreadyUser":"Already have a account? <a href=\"https:\/\/\/wp-login.php?\">Log in now.<\/a>","stats":"Stats"}}; /* ]]> */ </script> <script type='text/javascript'> /* <![CDATA[ */ var sharing_js_options = {"lang":"en","counts":"1"}; /* ]]> */ </script> <script type='text/javascript' src=''></script> <script type="text/javascript"> // <![CDATA[ (function() { try{ if ( window.external &&'msIsSiteMode' in window.external) { if (window.external.msIsSiteMode()) { var jl = document.createElement('script'); jl.type='text/javascript'; jl.async=true; jl.src='/wp-content/plugins/ie-sitemode/custom-jumplist.php'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(jl, s); } } }catch(e){} })(); // ]]> </script> <script type="text/javascript"> var skimlinks_pub_id = "725X584219" var skimlinks_sitename = ""; </script> <script type="text/javascript" defer src=""></script> <iframe src='' scrolling='no' id='likes-master' name='likes-master' style='display:none;'></iframe> <div id='likes-other-gravatars'><div class="likes-text"><span>%d</span> bloggers like this:</div><ul class="wpl-avatars sd-like-gravatars"></ul></div> <script> var _comscore = _comscore || []; _comscore.push({ c1: "2", c2: "7518284" }); (function() { var s = document.createElement("script"), el = document.getElementsByTagName("script")[0]; s.defer = true; s.src = (document.location.protocol == "https:" ? "https://sb" : "http://b") + ""; el.parentNode.insertBefore(s, el); })(); </script> <noscript> <p class="robots-nocontent"><img src="" alt="" style="display:none;" width="1" height="1" /></p> </noscript><script src="//" type="text/javascript" async defer></script> <script type="text/javascript"> _tkq = window._tkq || []; _stq = window._stq || []; _tkq.push(['storeContext', {'blog_id':'16784990','blog_tz':'0','user_lang':'en','blog_lang':'en','user_id':'0'}]); _stq.push(['view', {'blog':'16784990','v':'wpcom','tz':'0','user_id':'0','post':'77','subd':'telleme'}]); _stq.push(['extra', {'crypt':'UE5XaGUuOTlwaD85flAmcm1mcmZsaDhkV11YdWFnNncxc1tjZG9XVXhRREQ/V0xPZ1hKXy9qOVlTOU1tLzl+QndSclMwPWNEfGwtSG80S0N0OEosc2xoS1p6VHMyT3FhSUF+fDJjaFBjMXpjWGYlWnVPdlNKSX5BRi51U3klJWpBTDlmVGNZR0VoYW9DQ114bTNMRllhJnd+RElEMzgzY29NNmxCR1Y5TGM/dVJCTkZUdGgycjN+ZS15a2dDSnp8N1lFZW16a3ZHaTRibFQwbWNoNnR0X19FQXJ5NGFCZnlYcTNHdEJVUTFIWnU='}]); _stq.push([ 'clickTrackerInit', '16784990', '77' ]); </script> <noscript><img src="" style="height:0px;width:0px;overflow:hidden" alt="" /></noscript> <script> if ( 'object' === typeof wpcom_mobile_user_agent_info ) { wpcom_mobile_user_agent_info.init(); var mobileStatsQueryString = ""; if( false !== wpcom_mobile_user_agent_info.matchedPlatformName ) mobileStatsQueryString += "&x_" + 'mobile_platforms' + '=' + wpcom_mobile_user_agent_info.matchedPlatformName; if( false !== wpcom_mobile_user_agent_info.matchedUserAgentName ) mobileStatsQueryString += "&x_" + 'mobile_devices' + '=' + wpcom_mobile_user_agent_info.matchedUserAgentName; if( wpcom_mobile_user_agent_info.isIPad() ) mobileStatsQueryString += "&x_" + 'ipad_views' + '=' + 'views'; if( "" != mobileStatsQueryString ) { new Image().src = document.location.protocol + '//' + mobileStatsQueryString + '&baba=' + Math.random(); } } </script></body> </html>