You are here

Quick Interactive Web Pages with Java Sketchpad - A More Complicated Example: Displaying Units

Michael E. Mays

JavaSketchpad has a different feel from The Geometer's Sketchpad®:  It has no menus, dialog windows, or toolboxes.  This means you (as designer) have to think ahead to decide what interactions are appropriate and should be included.  Also, there are limitations based on the Java virtual machine that runs the applet in the browser. 

Perhaps the most limiting is that, with no assumptions about screen geometry built in, the only units available for measurements are pixels, and there is no provision in JavaSketchpad for directly adjusting the number of decimal places of the measurements reported.  JavaSketchpad does support calculations, however, so it is possible to convert from pixels to a more appropriate scale "behind the scene," hide the true measurement, and display the answer rounded appropriately. 

For example, a Sketchpad model of the "ladder problem" shows how a ladder is to be taken around a corner between two intersecting corridors. If you have Sketchpad installed on your computer, you can click on the picture to download the gsp file.

The interactive JavaSketchpad applet displays appropriate units:

Sorry, this page requires a Java-compatible web browser.

I made this change by directly editing the HTML code produced by The Geometer's Sketchpad, hiding the measurements in pixels and calculating the other measurements so the scale seems appropriate. For example, line {38} in the following code scales the hidden measurement of line {10} by an arbitrary 20 units, and line {42} converts the angle measure to degrees.

Michael E. Mays, "Quick Interactive Web Pages with Java Sketchpad - A More Complicated Example: Displaying Units," Convergence (December 2004)