- Add org.eclipse.birt.report.engine_Version.jar to your Java project, as outlined in the following steps:
- Select your Java project and choose File->Properties->Java Build Path->Libraries. Java Build Path appears, as shown in Figure 24-1.
Figure 24-1 Adding a JAR file to the compiler's classpath
- Choose Add External JARs. JAR Selection appears.
- Navigate to Eclipse /plugins directory. In a default Eclipse installation, this directory is in the following location:
- Select org.eclipse.birt.report.engine_Version.jar. Choose Open. Java Build Path reappears.
- Choose OK.
- Select your Java project and choose File->New->Other. Select a wizard appears.
Figure 24-2 The Select a wizard dialog
Choose Next. New Java Class appears, as shown in
Figure 24-3.
Figure 24-3 New Java Class
- Navigate to the folder where you want the Java source file to reside by choosing the Browse button beside Source Folder.
- If your new Java class is a part of a package, type the fully qualified package name in Package.
- In Name, type a name for your class.
- In Modifiers, choose Public.
- Choose the Browse button beside Superclass. Superclass Selection appears, as shown in Figure 24-4.
Figure 24-4 Superclass Selection
- In Choose a type, type the name of the adapter class for the ROM element. For example, enter Label EventAdapter for the Label element. Choose OK. New Java Class reappears.
- Select Generate comments. Choose Finish. A Java editor view appears, similar to the one shown in Figure 24-5.
Figure 24-5 The Java editor
- Add the event handler method for your new event handler class. Figure 24-6 shows the addition of an onPrepare( ) method that sets the background color of the label to red.
Figure 24-6 The onPrepare( ) method in the Java editor