Renderers and styling

Some predefined renderers produce IlvGraphic objects, which are instances of the IlvMapGraphic class. These renderers include IlvMapAreaRenderer, IlvMapPointRenderer, IlvMapCurveRenderer and IlvMapTextRenderer. The graphic objects produced by these renders can be styled by means of an IlvMapStyle object. The predefined data sources provided by JViews Maps use these renderers and make it possible to change the style of a layer without reloading the entire map.
The following code creates an IlvShapeDataSource and sets an IlvMapAreaRenderer to render the feature read by the data source. The fill color is set to red. A button is created whose action sets the color of the map to blue simply by changing the Paint attribute of the layer.
IlvShapeDataSource ds = new IlvShapeDataSource(shapeFile);
ds.setManager(view.getManager());
IlvMapAreaRenderer renderer = new IlvMapAreaRenderer(false, false);
IlvGraphicPathStyle style = new IlvGraphicPathStyle();
ds.getInsertionLayer().setStyle(style);
style.setFilling(true);
style.setPaint(Color.red);
ds.setFeatureRenderer(renderer);

JButton b = new JButton();
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
  IlvGraphicPathStyle style =       (  (IlvGraphicPathStyle)ds.getInsertionLayer().getStyle();
  style.setPaint(Color.blue);
  view.repaint();
 }
});