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.

Note: 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.

  1. In an IDL Editor window, open the object definition file by entering .EDIT export_grwindow_doc__define.pro at the command prompt.
  2. 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, 2
    This will display a three channel histogram plot and change the plot linestyle to dashed.

  3. Open the Export Bridge Assistant by entering IDLEXBR_ASSISTANT at the command line.
  4. 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.
  5. 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.

  6. 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.
  7. 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.

    Tree View Item

    Property Configuration

    IDL Export Bridge Project

    Accept the default value or make changes as desired:

    • Output classname
    • Process name
    • Output directory

    export_grwindow_doc

    Drawable object equals True

    Package name

    export_grwindow_doc

    OMODEL,OVIEW, OXAXIS, OXTEXT, OYAXIS, OYTEXT property

    Type: JIDLObjectI

    Array: False

    OPLOTCOLL property

    Type: JIDLObjectI

    Array: True

    SFILE property

    Type: JIDLString

    Array: False

    CHANGELINE method

    Enter different name if desired and mark

    Export as True

    STYLE argument

    Mutability: In

    Type: JIDLNumber

    Array: False

    CREATEPLOTS method

    Enter different name if desired and mark

    Export as True

    IMAGE, VROWS, VCOLS argument

    Mutability: In

    Type: JIDLNumber

    Array: True

    Convert majority: False

    VRGB argument

    Mutability: In

    Type: JIDLNumber

    Array: False

    OPEN method

    Enter different name if desired and mark

    Export as True

    SFILE argument

    Mutability: In

    Type: JIDLString

    Array: False

    You can choose not to export this parameter. If so, the method follows the path for cases where no argument is defined. (You will need to modify the Java code to read export_grwindow_doc.OPEN() instead of passing an argument.) If you do choose to export this method, the argument must either be a null string or a full file path.

  8. 5. Save the project by selecting File > Save project. Accept the default name and location or make changes as desired.
  9. 6. 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.
  10. 7. 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 .java and .class files, and is located in the Output directory.

Using the Java Export Object

The following section describes using the Java export object in a simple application.

Note: The file for this example, export_grwindow_doc_example.java, is located in the examples/doc/bridges/java subdirectory of the IDL distribution.

  1. Open the file named 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.
  2. Open the Windows Command window by selecting Start > Run and enter cmd in the textbox.
  3. Use the cd command to change to the directory containing the export_grwindow_doc directory.
  4. Reference the classpath of 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:
  5. 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.