arcgissamples\cartography\propertypage\SimpleRendererPropertyPage.java—ArcObjects 10.4 Help for Java | ArcGIS for Desktop
Simple dispersal renderer
arcgissamples\cartography\propertypage\SimpleRendererPropertyPage.java
/* Copyright 2015 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 at <your ArcGIS install location>/DeveloperKit10.4/userestrictions.txt.
* 
*/
package arcgissamples.cartography.propertypage;

import java.io.IOException;
import javax.swing.JFrame;

import arcgissamples.cartography.SimpleDispersalRenderer;

import com.esri.arcgis.carto.IFeatureRenderer;
import com.esri.arcgis.interop.AutomationException;
import com.esri.arcgis.cartoUI.BaseCustomRendererPropertyPage;
import com.esri.arcgis.interop.extn.ArcGISCategories;
import com.esri.arcgis.interop.extn.ArcGISExtension;

@ArcGISExtension(categories={ArcGISCategories.ESRIRendererPropertyPages})
public class SimpleRendererPropertyPage extends BaseCustomRendererPropertyPage {

  SimpleRendererPropertyPageUI simplePropertyPageUI;

  @Override
  // You can apply the properties from your UI to the renderer in this method
  public void apply(IFeatureRenderer arg0) {
    SimpleDispersalRenderer simpleRenderer=(SimpleDispersalRenderer)arg0;

    //Retrieve the value from the textfield of the form
    String dispersalRatio=this.simplePropertyPageUI.getJTextField().getText();

    //set the property of the custom renderer
    simpleRenderer.setDispersalRatio(Double.parseDouble(dispersalRatio));

  }

  @Override
  // This returns the progID of the renderer for which you are associating the property page
  public Class getCustomRendererDef() {
    return arcgissamples.cartography.SimpleDispersalRenderer.class;
  }

  // This is the custom description of your property page
  @Override
  public String getDescription() throws IOException, AutomationException {
    return "Custom Renderer Property page";
  }

  // This is the Name of your custom renderer
  @Override
  public String getName() throws IOException, AutomationException {
    return "SimpleDispersalRenderer";
  }

  // Preview bitmap for the renderer that appears on the page.
  @Override
  public int getPreviewImage() throws IOException, AutomationException {
    return 0;
  }

  // This is the Type of your custom renderer
  @Override
  public String getType() throws IOException, AutomationException {
    return "Custom Renderer";
  }

  // Every Property Page has a UI associated with it,so create an UI and return the object of that UI
  @Override
  public JFrame initGUI(IFeatureRenderer arg0) {
    try {
      this.simplePropertyPageUI = new SimpleRendererPropertyPageUI();
      } catch (Exception e) {
      e.printStackTrace();
      }
      return this.simplePropertyPageUI;

  }

  // This is the page priority.The higher the priority,the sooner the page appears in the containing property sheet.
  @Override
  public int getPriority() throws IOException, AutomationException {
    return 0;
  }

}