From BC$ MobileTV Wiki
Revision as of 01:59, 24 February 2021 by Bcmoney (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
Java (cup of java) Logo
Applet & JNLP Java WebStart icon

Applet is a legacy Java technology for embedding and presenting dynamic/interactive code & interface components into HTML rendered by a browser, achieving one of the earliest RIA stacks. The term Applet is most commonly used to describe technology originally released by Sun for the Java programming language, designed to run in an end-user's browser client.




[2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12] [13]

Java Applet

The method below shows how to embed an Applet on an HTML page using the deployJava JavaScript helper utility from Sun Microsystems/Oracle, which was during the peak of their lifetime, the recommended way of interacting with and using applets (along with traditional fallbacks to the straight Object/Embed and Applet custom tag methods, for browsers with JavaScript and/or embedded objects disabled or otherwise unavailable):

 <script src=""></script>
    var attributes = {codebase:'',
                      width:710, height:540} ;
    var parameters = {fontSize:16} ;
    var version = '1.6' ;
    deployJava.runApplet(attributes, parameters, version);
   <object type="application/x-java-applet;version=1.5.0" codebase="" width="710" height="540">
     <param name="archive" value="Java2Demo.jar" />
     <param name="code" value="java2d.Java2DemoApplet.class" />
     <param name="backgroundcolor" value="FFFFFF" />
     <embed type="application/x-java-applet;version=1.5.0" codebase="" archive="Java2Demo.jar" code="java2d.Java2DemoApplet.class" width="710" height="540">
         <applet archive="Java2Demo.jar" code="java2d.Java2DemoApplet.class" width="710" height="540">
           <param name="backgroundcolor" value="FFFFFF" />

Deprecated simple method (no longer works in many modern browsers):

 <applet width=300 height=300 code="MyCoolApplet.class">
   <param name="background" value="FFFFFF"></param>
   <param name="shadowcolor" value="FFFFFF"></param>
     <img src="MyCoolApplet.jpg" title="You need to enable Java to see this applet." />

The above code basically says you have an Applet that you want to display with a width of 300 (pixels) and height of 300 (pixels), and with a Java class that generates the applet named "MyCoolApplet" (where is some Java code which has already been compiled into MyCoolApplet.class. It also accepts some parameters as specified by the <param> tag, which represent a name and value pair; for example "background" for the color of this applet's background, in this case set to FFFFFF or white (notice it does not use the opening "#" as in "#FFFFFF" hash to represent the color value as a hexadecimal number as CSS and HTML styles use). (NOTE: you can not, however, use the code directly in the applet, this will result in a rendering error and either the fallback image of the applet within the <applet> tags, or the default empty applet window, or nothing, depending on the browser.)






External Links


  1. Flash Satay - Embedding Flash While Supporting Standards:
  2. Introduction to the AWT -- description of Java's user interface toolkit:
  3. Java AWT Tutorial:
  4. The "new" AWT Tutorial: (top tutorial back in 1995-1996 when AWT first came out)
  5. Overview of the AWT:
  6. Java AWT tutorial for beginners:
  7. AWT Tutorial: | PDF
  8. Java AWT Graphics Example:
  9. "Java in a Nutshell", by David Flanaga (BOOK): | AWT changes section (Freely available online now)
  10. "Java AWT Reference", by John Zukowski (BOOK):
  11. Brewing Java - A Tutorial: (from 1990s Java approaches... in 2019 not THAT different, well except for Lambdas/Functional stuff)
  12. Java AWT Code Examples:
  13. Java Code Examples for java.awt.Frame:
  14. jlGui - Music Player (JNLP Launch file configurator for standalone desktop application version):
  15. Two Player Pong:
  16. Pong Applet:
  19. How to Form a TCP Connection Between a JavaScript Program and Java Server:
  20. StephenWare's Java-JS Socket Bridge (Fork with minor improvements):
  21. Applet game demos:
  22. Running an Applet in Netbeans:
  23. Resizing an applet by overriding its original size:
  24. Java Applet Windows size in Eclipse:
  25. Invoking Applet Methods From JavaScript Code:
  26. Move text left and right in Java GUI:
  27. Animation in Applet:
  28. Applet - Simple squares and cube with for loop:
  29. Fill Rectangle & Square in Applet Window Example:
  30. Java Applet program to show the animation of a bouncing ball:
  31. Oracle Reminds Java Developers That Soon They Won’t Have a Browser to Run Applets:

See Also

Java | JavaFX | J2ME | Widget