Java IDLgrWindow Based Histogram Plot Generator
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. Run the example procedure by entering export_grwindow_doc__define at the IDL command prompt or view the file in an IDL Editor window by entering .EDIT export_grwindow_doc__define.pro.
Complete the following steps to duplicate this example.
- In an IDL Editor window, open the object definition file by entering
.EDIT export_grwindow_doc__define.proat the command prompt. - Open the Export Bridge Assistant by entering IDLEXBR_ASSISTANT at the command line.
- Select to create a Java export object by selecting File → New Project → Java and browse to select
export_grwindow_doc__define.pro. Click Open to load the file into the Export Assistant. - Set export object characteristics as described in the following table. When you select the tree view item listed in the left column, configure the related properties as noted in the right column.
- Save the project by selecting File → Save project. Accept the default name and location or make changes as desired.
- Verify that the object elements you want to export are listed in the Export log panel. If the expected items are not present, one or more items may still have an UNSPECIFIED field value that must be changed.
- Build the export object by selecting Build → 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 .javaand .classfiles, and is located in the Output directory.
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.
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.
Using the Java Export Object
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.
- Open the file named
export_grwindow_doc_example.javain the location referenced above and copy it to your<output directory>/export_grwindow_docdirectory where<output directory>was the directory specified as the Output directory in the Assistant. - Open the Windows Command window by selecting Start → Run and enter
cmdin the textbox. - Use the
cdcommand to change to the directory containing theexport_grwindow_docdirectory. - Reference the classpath of
javaidlb.jarin the compile statement. Enter the following two commands (as single lines) to compile and execute the program, replacingIDL_DIRwith 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_exampleTip
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.