Home > JavaSketchpad > About JavaSketchpad > How to Create and Publish JavaSketches

How to Create and Publish JavaSketches

Every JavaSketch is an applet inside a Web page. The geometric objects and relationships visualized by a particular JavaSketch are described in that page's HTML in a human-readable language called the JavaSketchpad construction language. For example, a simple triangle might appear in JavaSketchpad as

{1} Point (144,130);

{2} Point (24,130);

{3} Point (84,20);

{4} Segment (3,1) [thick];

{5} Segment (1,2) [thick];

{6} Segment (2,3) [thick];

Create a JavaSketch

There are three ways you can produce Web pages containing JavaSketchpad constructions:

1. By using The Geometer's Sketchpad

Since Sketchpad knows the JavaSketchpad construction language, it can describe your construction in that language for you. Make a construction in Sketchpad, and choose File | Save As. Then request that your construction be saved in HTML/JavaSketchpad format. This is the easiest way to create a JavaSketch, but be aware that since JavaSketchpad is a small applet designed for fast downloading, it does not "understand" all of the possible objects that can be defined in the desktop Sketchpad software. Sketchpad warns you when it cannot save all of your objects as HTML. See the JavaSketchpad Workarounds section for help in understanding, and working around, the difference between Sketchpad and JavaSketchpad construction possibilities. For more general help getting started with this route to JavaSketchpad publishing, choose Advanced Topics from Sketchpad's Help menu and consult the JavaSketchpad publishing section.

2. By hand

Since the JavaSketchpad construction language is human-readable, you can type it "by hand" into a Web-page editor. You'll need to understand the syntax and grammar of that language, which is described at Developer's Grammar. By manually entering or editing JavaSketches, you have access to all of the functionality of JavaSketchpad—including features of JavaSketchpad that aren't available in The Geometer's Sketchpad. However, responsibility for making sure your construction is expressed in legal, well-formed language according to the grammar of  JavaSketchpad is up to you.

3. By writing programs that write JavaSketchpad

Some authors familiar with other programming languages or paradigms choose to write programs that create Web pages including JavaSketchpad constructions in them, and then to use JavaSketchpad to visualize those constructions. Popular languages include Mathematica, JavaScript, and Python, although any language that can create text files can, in theory, be used to create JavaSketch-enhanced Web pages. Again, you'll need to understand the JavaSketchpad Developer's Grammar if you want to teach your programs how to speak the JavaSketchpad construction language.

Publish a JavaSketch

Once you have an HTML Web page describing a JavaSketchpad construction, you'll need the JavaSketchpad applet, such as jsp5.jar, to actually visualize that construction. This applet needs to be stored in the same folder or directory as your Web page, either on your hard disk (if you're using JavaSketchpad for local purposes) or on your Web site (if you're publishing JavaSketches on the Internet). You can copy the JSP applet from your hard disk (Sketchpad places it next to your HTML file by default) or you can download it from the JavaSketchpad Download Center. Once the JSP applet is stored in the same folder as your Web page, you can visualize and interact with your construction by opening your Web page from any Java-capable Internet browser, either locally (on your hard disk) or from anywhere on the Internet. You can put more than one JavaSketchpad construction in a single Web page, and entire collections of JavaSketchpad-enhanced Web pages can share a single copy of the Java applet.

More Information

For more detail on the relationships between JavaSketchpad construction language, Web pages or HTML documents, the JSP applet, and your hard disk or Web server, see How JavaSketchpad Works.