Easy Explanation of Java Applets
Java applets are graphical computer programs written in the object oriented language of Java. Java applets, like applets written in other programming languages, require a host container, such as a browser, in which to run.
-
Purpose of a Java Applet
-
A Java applet is used by webmasters wanting dynamic or interactive content for their websites. When people visit these websites, their browsers automatically download and execute the Java applet for them to interact with. For example, the 3D applet Bike CAD (Computer Aided Design) in Java Boutique's Educational category lets users design their own bike. The applet accepts user-input for the dimensions of various features like wheel size, and then draws the bike to those specifications.
-
Key Features of a Java Applet
-
A key feature of Java applets is their graphical interactivity with the user. Java applets have buttons, list boxes and other controls that users make selections with. The applet responds to these selections by displaying new content. This new content will typically be a mix of text and graphical shapes like the lines and ellipses used by the aforementioned Bike CAD applet. Contrast this type of interaction with that of a command console, where all input and output is text-based.
Java Applets are Event-Driven
-
An essential concept in Java applets is that of events, which developers of Java applets refer to as milestones. A milestone is an event in the life cycle of an applet's execution, such as the loading of the applet into the browser, or the push of a button or other control. A mouse click on the applet's window is another type of milestone, as is the exposure of the Java applet's window, when a window from another application is moved or resized.
Java applet developers are responsible for making sure the applet responds appropriately to each milestone. For example, when the user selects her time zone from the list box on a Java applet displaying the time, she expects to see the clock's hands reflect the current time for her locale.
Where to Find Java Applets
-
You can find Java applets at sites scattered throughout the web. Some sites specialize in offering Java applets that you can sample. Java Boutique is an example of such a site. So is Boston University's Math Department, which lists Java applets that teach scientific concepts like fractals and chaos theory. Some sites, including Java Boutique, let you see the applet's source code, so you can learn how to develop your own applets.
Security and Java Applets
-
Since Java applets are interactive and produce dynamic content, executing them involves a greater potential security risk than executing the static content of a plain web page. To address the potential security threats, Java applets make use of security certificates. Applets with such certificates are called signed applets, and have privileges that unsigned and possibly untrustworthy applets don't have. A signed applet can, for example, access files on your computer while an unsigned applet can't, unless you give it explicit permission.
References
Resources
- Photo Credit "Nerdy Bookshelf Part One" is Copyrighted by Flickr user: schoschie (Niels Heidenreich) under the Creative Commons Attribution license.