Applet

Summary: Use Java Applets in PmWiki pages
Version: 2014-08-25
Status: Stable
Prerequisites: pmwiki-2.x
Maintainer: Dfaure
Discussion: Applet-Talk
Download: applet.phpΔ

Description

The applet.phpΔ script provides an (:applet:) markup to handle this.

Proceed to installation steps as usual for cookbook recipe scripts.

  • download file and place in cookbook directory
  • and add include_once("$FarmD/cookbook/applet.php"); in local/config.php

Notes

Java Applet Installation

  • Put the java applet files (usually .class hierarchies or .jar) into pub/applets subdirectory (that you may need to create).
  • If required, extra subdirectories may be used to separate several applets.

Markup usage

Once installed, the following markup is available:

(:applet PARAMETERS... :)

with the following parameters:

code=CLASS
The applet entry point class (required).
width=..., height=...
The applet geometry (required).
archive=JAR
The applet jar archive name (optional, to be used if the applet is provided as an archive).
codebase=SUBDIRECTORY
The extra subdirectory specification needed to reach the applet (optional, the trailing slash is required).

All other supplied parameters are forwarded to the selected applet:

MY.PARAM=MY_VALUE
is translated as <param name='MY.PARAM' value='MY_VALUE' /> tags.

Example

As a live example, you may have a try with the Free JDK Demo Clock applet provided by Sun here:

  • Download the demo archive and extract it into your pub/applets
  • Use the markup below (on a single line) to display the clock:
(:applet codebase="demo/clock/classes"
         code="JavaClock.class"
         width="150" height="150":)

Life example: CalculatorApplet (adjusted by PKHG)

History

2014-08-25
Update for PHP 5.5 compatibility
2007-12-05
Solved (at last) the $PurDirUrl issue.
2006-10-28
Added RecipeInfo data.
2005-10-31
Initial release.

Contributors

Dfaure

See Also

PTViewer

Comments

See discussion at Applet-Talk

User notes +1: If you use, used or reviewed this recipe, you can add your name. These statistics appear in the Cookbook listings and will help newcomers browsing through the wiki.