Rendering any component as an image using SnapshotRenderer

AjaxSwing provides a universal renderer and updater that can be used to support any component. It works by taking a snapshot image and inserting it into the HTML page. SnapshotRenderer is an ideal choice for graphs, charts and other dynamically generated images that are shown in Swing application. If the component is enabled SnapshotRenderer will provide support for mouse clicks and certain keyboard events automatically. While SnapshotRenderer will work for any component, it is recommended to use it as a last resort or for components that use custom drawing. Every time a page is rendered an image will be generated in the temporary directory so there is a certain performance overhead.

Example
Suppose a Network Management System uses a custom component com.acme.NetworkMap to display a graphics map of nodes and connections between them. NetworkMap is derived from JPanel and overrides paint() method to draw itself. To see the maps in HTML we are going to register a SnapshotRenderer as a custom renderer in the application properties file for NetworkMap as shown below

renderer.com.acme.NetworkMap=com.creamtec.ajaxswing.v4.render.SnapshotRenderer