public void actionPerformed(ActionEvent actionEvent) {
    String cmd = actionEvent.getActionCommand();
    if ("Point".equals(cmd)) {
      ap.setPolygonAttributes(new PolygonAttributes(
          PolygonAttributes.POLYGON_POINT, PolygonAttributes.CULL_BACK,0));
      ap.setPointAttributes(new PointAttributes(10, false));
    } else if ("Line".equals(cmd)) {
      ap.setPolygonAttributes(new PolygonAttributes(
          PolygonAttributes.POLYGON_LINE, PolygonAttributes.CULL_BACK,0));
      ap.setLineAttributes(new LineAttributes(3,
          LineAttributes.PATTERN_DASH, false));
    } else if ("Polygon".equals(cmd)) {
      ap.setPolygonAttributes(new PolygonAttributes(
          PolygonAttributes.POLYGON_FILL, PolygonAttributes.CULL_BACK,0));
    } else if ("Single".equals(cmd)) {
      ColoringAttributes ca = new ColoringAttributes();
      ca.setColor(0.5f, 0.5f, 0.5f);
      ap.setColoringAttributes(ca);
      ap.setMaterial(null);
      RenderingAttributes ra = new RenderingAttributes();
      ra.setIgnoreVertexColors(true);
      ap.setRenderingAttributes(ra);
    } else if ("Flat".equals(cmd)) {
      ColoringAttributes ca = new ColoringAttributes();
      ca.setShadeModel(ColoringAttributes.SHADE_FLAT);
      ap.setColoringAttributes(ca);
      ap.setMaterial(null);
      RenderingAttributes ra = new RenderingAttributes();
      ra.setIgnoreVertexColors(false);
      ap.setRenderingAttributes(ra);
    } else if ("Gouraud".equals(cmd)) {
      ColoringAttributes ca = new ColoringAttributes();
      ca.setShadeModel(ColoringAttributes.SHADE_GOURAUD);
      ap.setColoringAttributes(ca);
      ap.setMaterial(null);
      RenderingAttributes ra = new RenderingAttributes();
      ra.setIgnoreVertexColors(false);
      ap.setRenderingAttributes(ra);
    } else if ("Lighting".equals(cmd)) {
      ap.setMaterial(new Material());
      RenderingAttributes ra = new RenderingAttributes();
      ra.setIgnoreVertexColors(true);
      ap.setRenderingAttributes(ra);
    }
  }