Applet basics

All of the code to use Juggling Lab at your site is in the single file JugglingLab.jar. This archive includes the applet class JugglingLab.class, which is configurable to contain any or all of the following elements: An animation view, a pattern input text field, a pattern browser list, a siteswap generator, and a ladder diagram editor.

Also the following classes within JugglingLab.jar can be run as command line applications:

Juggling Lab applet parameters

Juggling Lab recognizes six parameters within the <applet> tag, called config, animprefs, notation, pattern, jmldir, and jmlfile. Each of these parameters is optional, and set as follows:

config
This parameter configures which interface elements are included in the applet display. It is comprised of semicolon-separated assignment settings, for example "entry=siteswap;view=jml;locale=he"
  • entry – determines which notation (if any) is used in the pattern input panel shown on the left of the applet display. Values are 'none' and 'siteswap'; default value is 'siteswap'.
  • view – determines which type of animation view is shown on the right of the applet display. Values are 'none', 'simple', 'edit', 'selection', and 'jml'; default value is 'simple'.
  • locale – determines the user interface language, overriding the system default. Values are in the form 'xx_YY', where 'xx' is an ISO 639-1 two-letter language code and 'YY' is an optional ISO 3166 two-letter country code. Examples are 'en_US' (US English) and 'fr' (French). Default is the system-supplied locale.
animprefs
This parameter defines how the animator itself will work. (These settings are made in the "Animation Preferences" panel when Juggling Lab is run as an application.) It is comprised of semicolon-separated assignment settings, for example "slowdown=1.0;fps=10"
  • stereo – determines whether to display a stereo pair of images. Values are true/false; default value is false.
  • dbuffer – determines if the display will be double-buffered to minimize flicker. Values are true/false; default value is true.
  • startpaused – causes the animator to wait for a prompt from the user to begin animation. Values are true/false; default value is false.
  • catchsound – determines whether catches are audible. Values are true/false; default value is false.
  • bouncesound – determines whether bounces off the ground are audible. Values are true/false; default value is true.
  • fps – sets the number of frames per second to be drawn by the animator. Values are floating point numbers greater than 0.0; default value is 30.0.
  • slowdown – defines an overall time slowdown factor (e.g., slowdown=1.0 is actual speed, slowdown=2.0 is half actual speed). Values are floating point numbers greater than 0.0; default value is 2.0.
  • border – defines a border (in pixels) around the animation. Values are integers greater than or equal to 0; default value is 0.
notation
This parameter determines which notation component will be used to parse the pattern specified in the pattern parameter below. Currently recognized values are 'jml' and 'siteswap'; default is 'siteswap'.
pattern
This parameter defines the pattern to be juggled. The text string provided here is sent to the notation component defined in the notation parameter above, for conversion to JML and animation. The expected input format varies by notation; for the notations currently implemented it is:
  • jml – the text string should be in standard JML format, described in the JML documentation. To get examples, use the "Save as HTML" feature in the application and look at the HTML generated.
  • siteswap – text string should be in one of two formats (the applet will auto-detect which you're using):
    1. A siteswap pattern alone, using the same format as in the "Pattern" input box on the siteswap input panel. For example "(4x,4x)".
    2. A list of settings in the form used in the "Manual settings" field of the siteswap input panel.
jmldir
An absolute link to a directory used as a base for jmlfile below.
jmlfile
This parameter causes the applet to load a JML file from the server. If the JML file contains a pattern, it is loaded into the animator and the pattern parameter above is ignored. If the file is a pattern list, it is displayed in a "Patterns" tab attached to the left side of the applet. The format of this parameter is a UNIX-like path to the pattern file, relative to either jmldir if defined, or to the HTML document containing the applet. For example, patterns/demo.jml.

Examples

Look at the HTML files in the Juggling Lab distribution for examples of how you can use the applet within a web page.