You can add a custom annotation type to your application.
To add a custom annotation type to the annotation services,
complete the following steps. See the Application Programming
Reference for details about API usage.
Remember: This
custom annotation cannot be saved because the built-in annotation
engine will not support or understand it.
- Create a subclass of CMBPageAnnotation.
public class TImageAnnotation extends CMBPageAnnotation
- Define a constant for the custom annotation with a value
larger than 100. The range of 1 to 99 is reserved.
public static final int ANN_IMAGE = 101;
- Override the following methods of CMBPageAnnotation.
public void draw(Graphics2D g2);
public void drawOutline(Graphics2D g2);
public CMBPropertiesPanel getAnnotationPropertiesPanel();
- Implement the CMBAnnotationPropertiesInterface interface
to create the properties window. The properties window
appears when a user chooses to edit the custom annotation properties.
- Provide set and get methods specific to the custom annotation
properties.
- Add the custom annotation type.
annoServices.prepareToAddAnnotation(TImageAnnotation.ANN_IMAGE,
"TImageAnnotation",1);
The annotation type sample TImageAnnotation is
included in the samples directory. The sample
demonstrates how to add a custom annotation type to the annotation
services.