|
IDL Connectivity Bridges: Creating Custom Java Export Objects |
|
This drawable object example inherits from IDLgrWindow and creates a histogram plot for a selected monochrome or RGB image file. While this example does contain several custom methods including those for opening a file, creating the plots, and changing plot characteristics, it does not use keyboard or mouse events. See Java IDLitWindow Surface Manipulation for such an example.
| Example Code The object definition file, export_grwindow_doc__define.pro is located in the examples/doc/bridges subdirectory of the IDL distribution. |
Complete the following steps to duplicate this example.
.EDIT export_grwindow_doc__define.pro at the command prompt.
| Note It is a good idea to test the functionality of an object before exporting it. After compiling the file, enter the following lines at the command line and make sure the output is what is expected for this object. oPlotWindow = OBJ_NEW("export_grwindow_doc") oPlotWindow->CHANGELINE, 2This will display a three channel histogram plot and change the plot linestyle to dashed. |
New Project
Java and browse to select export_grwindow_doc__define.pro. Click Open to load the file into the Export Assistant.
| Note Export Bridge Assistant details are available in Specifying Information for Exporting. Refer to that section if you need more information about the following items. |
| Note Set the Export parameter to True for all items in this list unless otherwise noted. |
| Tip You can select multiple items in the tree view and set properties for the group. |
Save project. Accept the default name and location or make changes as desired.
Build object. The Build log panel shows the results of the build process. A subdirectory, named export_grwindow_doc (based on the object name), contains the .java and .class files, and is located in the Output directory. The following section describes using the Java export object in a simple application.
| Example Code The file for this example, export_grwindow_doc_example.java, is located in the examples/doc/bridges/java subdirectory of the IDL distribution. |
export_grwindow_doc_example.java in the location referenced above and copy it to your <output directory>/export_grwindow_doc directory where <output directory> was the directory specified as the Output directory in the Assistant.
Run and enter cmd in the textbox.
cd command to change to the directory containing the export_grwindow_doc directory.
javaidlb.jar in the compile statement. Enter the following two commands (as single lines) to compile and execute the program, replacing IDL_DIR with the IDL installation directory: javac -classpath ".;IDL_DIR\resource\bridges\export\java\javaidlb.jar" export_grwindow_doc\export_grwindow_doc_example.java java -classpath ".;IDL_DIR\resource\bridges\export\java\javaidlb.jar" export_grwindow_doc.export_grwindow_doc_example
| Tip See Note on Running the Java Examples for information on executing Java commands on a non-Windows platform. |
After compiling and running the project, a Java interface will display a histogram plot of an RGB image. You can change the linestyle of the plot by making a selection from the listbox. You can also create a histogram plot for a new image by clicking the button.
IDL Online Help (March 06, 2007)