14.07.2013 Views

Contents - Cultural View

Contents - Cultural View

Contents - Cultural View

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Java applet 34<br />

element. [19] A non standard embed element can be used [20] with<br />

Mozilla family browsers. This specifies the applet's source and<br />

location. Object and embed tags can also download and install Java<br />

virtual machine (if required) or at least lead to the plugin page. Applet<br />

and object tags also support loading of the serialized applets that start<br />

in some particular (rather than initial) state. Tags also specify the<br />

message that shows up in place of the applet if the browser cannot run<br />

it due any reason.<br />

However, despite object being officially a recommended tag, as of<br />

2010, the support of the object tag was not yet consistent among<br />

browsers and Sun kept recommending the older applet tag for<br />

deploying in multibrowser environments, [20] as it remained the only<br />

tag consistently supported by the most popular browsers. To support<br />

multiple browsers, the object tag currently requires JavaScript (that<br />

recognizes the browser and adjusts the tag), usage of additional<br />

browser-specific tags or delivering adapted output from the server side.<br />

Deprecating applet tag has been criticised. [21] Oracle now provides a<br />

maintained JavaScript code [22] to launch applets with cross platform<br />

workarounds.<br />

Simple examples<br />

A basic example using the java.applet package<br />

The following example is made simple enough to illustrate the<br />

essential use of Java applets through its java.applet package. It also<br />

uses classes from the Java Abstract Window Toolkit (AWT) for<br />

producing actual output (in this case, the "Hello, world!" message).<br />

import java.applet.Applet;<br />

import java.awt.*;<br />

// Applet code for the "Hello, world!" example.<br />

// This should be saved in a file named as "HelloWorld.java".<br />

public class HelloWorld extends Applet {<br />

Sufficient running speed is also utilized in applets<br />

for playing non trivial computer games like<br />

chess [5]<br />

NASA World Wind (open source) is a second<br />

generation applet [6] that makes heavy use of<br />

OpenGL and on-demand data downloading to<br />

provide a detailed 3D map of the world.<br />

// This method is mandatory, but can be empty (i.e., have no actual<br />

Web access to the server console at the hardware<br />

code).<br />

level with the help of a Java applet<br />

public void init() { }<br />

// This method is mandatory, but can be empty.<br />

public void stop() { }<br />

// Print a message on the screen (x=20, y=10).<br />

public void paint(Graphics g) {

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!