Simple add-in in ArcMap

This sample shows how to create and consume the following types of ArcGIS add-ins through ArcMap:
  • Custom button
  • Custom tool
  • Tool palette
  • Toolbar
  • Menu
  • Dockable window
  • Application extension

How to use

See How to use ArcGIS samples for help on running the sample.

  1. Double-click the SimpleAddin.esraddin file in developer kit home\java\samples\arcobjects\addin\simpleaddin\lib. A dialog box appears asking if you want to install the add-in. Click Yes to install.
  2. Start ArcMap.
  3. Click the Customize menu and click Customize Mode. The Customize dialog box appears.
  4. Click the Toolbars tab. Scroll down and select the Sample Java Toolbar check box.
  5. Verify that you can see a toolbar containing the Java Add Layer button, ESRI Fixed Zoom Out command, Java Draw Polygon tool, Java Sample menu containing the Java Add Layer button, and a custom tool palette containing the Draw Polygon tool and Zoom In tool.
  6. Click the Commands tab.
  7. Select each category in Step 5, then drag the respective commands onto an existing toolbar.
  8. Click the Java Add Layer command. This command opens a file chooser and allows you to browse to data.
  9. Browse to a Shapefile in developer kit home\java\samples\data\usa\states.shp to add the layer to the map.
  10. Click the Draw Polygon tool and draw a polygon on the map. When finished, this tool creates a solid blue polygon graphic on the map.
  11. Click the Java ShowDocWin command. This command pens a dockable window.
  12. Click the Show/Update Layer LayerList button. The states layer shows in the list. You can dock this window anywhere in ArcMap as permitted.
  13. Open a new document by browsing to developer kit home\java\samples\data\mxds\World.mxd (it is not necessary to save the existing map document). Notice the application extension is getting called and the dockable window is visible.
  14. Click the Show/Update LayerList button. All the layers for world.mxd show in the list.
  15. When you click the Customize Menu, then click Extensions, you can see the Java Sample Extension as one of the available extensions.

If you installed the samples feature, you will find the files associated with this sample in <Your Developer Kit install location>\DeveloperKit10.4\Java\Samples\ArcObjects.

addins\button\ Opens a JFileChooser where you can select a layer, then add it to the map. This will be called when you click the AddLayer custom command.
addins\tool\ A custom tool. Click the tool and draw a polygon graphic on the map.
addins\dockablewindow\ The dockable window. If you have a map open, and when you click the Show Dockable Window button, you can see it shows all the available layers on the map. This window can be docked anywhere inside ArcMap.
addins\extension\ The application extension. When you open a new map document, this application extension is called and in turn, opens a dockable window.
addins\util\ A utility file that filters and shows only shape files in the file chooser.

Development licensing Deployment licensing
ArcGIS for Desktop Advanced ArcGIS for Desktop Basic