CONTENTS

Custom tools

You can create custom tools for the Tool Panel. Custom tools allow users to choose a basic tool (such as line, rectangle, ...), color, and pen by one mouse click.

Say you wish to allow your users to draw roads and rivers on a map. Let's roads should be drawn with the line tool (tool code 1), in red color (#FF0000), and square solid pen of thickness 3 (pen code 213), and the river should be drawn with the freee hand tool (tool code 0), in red color (#0000FF), with the pen 211

To implement the tools you have to do the following:

  1. Prepare a custom icons for the road and rive tools, and name thier files road.gif and river.gif.
  2. Include the words road and river in the tool list defined by the parameter tool of the Tool Panel:
  3. Describe the new tools using parameters road and river. The values of the parameters must be specified as: basic_tool_code, color, pen_code
Here is an example code describing the new custom tools:
       <applet code="ControlPanel.class" ... >
           <param name="tools" value="road, river">
           <param name="road"  value="1,#FF0000,213">
           <param name="river" value="0,#0000FF,211">
           ...
       </applet>
       

Note: Custom tools can be used as an alternative to the basic tools, colors and pens. Don't display the ColorPanel, and PenPanel if you're using custom tools, and don't mix custom and basic tools on the tool panel.