Editing in a custom application
arcgissamples\editing\TOCToolbarPanel.java
/* Copyright 2010 ESRI
* 
* All rights reserved under the copyright laws of the United States
* and applicable international laws, treaties, and conventions.
* 
* You may freely redistribute and use this sample code, with or
* without modification, provided you include the original copyright
* notice and use restrictions.
* 
* See the use restrictions.
* 
*/
package arcgissamples.editing;

import java.awt.GridBagLayout;
import javax.swing.JPanel;
import com.esri.arcgis.beans.TOC.TOCBean;
import java.awt.GridBagConstraints;
import com.esri.arcgis.beans.toolbar.ToolbarBean;
import com.esri.arcgis.controls.ControlsMapNavigationToolbar;
import com.esri.arcgis.controls.esriToolbarOrientation;
import com.esri.arcgis.systemUI.esriCommandStyles;

/* This class represents a panel that contains the TableOfContents (TOC) control
 * and the Toolbar control side-by-side. */
public class TOCToolbarPanel extends JPanel {

  private static final long serialVersionUID = 1L;

  private TOCBean toc = null;

  private ToolbarBean toolbarNavigation = null;

  public TOCToolbarPanel() {
  super();
  initialize();
  }
  private void initialize() {
  GridBagConstraints gridBagConstraints1 = new GridBagConstraints();
  gridBagConstraints1.gridx = 1;
  gridBagConstraints1.fill = GridBagConstraints.VERTICAL;
  gridBagConstraints1.gridy = 0;
  GridBagConstraints gridBagConstraints = new GridBagConstraints();
  gridBagConstraints.gridx = 0;
  gridBagConstraints.weighty = 1.0D;
  gridBagConstraints.weightx = 1.0D;
  gridBagConstraints.fill = GridBagConstraints.BOTH;
  gridBagConstraints.gridy = 0;
  this.setSize(300, 200);
  this.setLayout(new GridBagLayout());
  this.add(getToc(), gridBagConstraints);
  this.add(getToolbarNavigation(), gridBagConstraints1);
  }


  public TOCBean getToc() {
  if (toc == null) {
    try {
    toc = new TOCBean();
    } catch (java.lang.Throwable e) {
    e.printStackTrace();
    }
  }
  return toc;
  }

  public ToolbarBean getToolbarNavigation() {
  if (toolbarNavigation == null) {
    try {
    toolbarNavigation = new ToolbarBean();
    toolbarNavigation
      .setOrientation(esriToolbarOrientation.esriToolbarOrientationVertical);
    toolbarNavigation.addItem(new ControlsMapNavigationToolbar(), 0, 0,
      false, 0, esriCommandStyles.esriCommandStyleIconOnly);
    } catch (java.lang.Throwable e) {
    e.printStackTrace();
    }
  }
  return toolbarNavigation;
  }

}