The following examples use the three object classes as canvases for drawable objects. You can use them with the Export Bridge by following the procedure described in Java Wrapper Example or use them with the Export Bridge Assistant (for more information, see Using the Export Bridge Assistant).
The IDLgrWindow example uses object graphics to display and manipulate a map . The idlgrwindowexample__define.pro, file, located in the examples/doc/bridges/ subdirectory of the IDL distribution, contains the example code.
The IDLitDirectWindow example uses direct graphics to create a palette on which you can draw and erase lines. The idlitdirectwindowexample__define.pro, file, located in the examples/doc/bridges/ subdirectory of the IDL distribution, contains the example code.
The IDLitWindow example uses the iSurface tool to plot a Hanning transform on a surface. The idlitwindowexample__define.pro, file, located in the examples/doc/bridges/ subdirectory of the IDL distribution, contains the example code.
Java Wrapper Example
An example Java wrapper that works with all three of the canvas types described above is included in the IDL distribution. The application accepts a parameter that specifies the name of the IDL class to use.
Note: Drawable Java objects are not supported on macOS.
Note: The Export Bridge Assistant creates wrapper objects comparable to the code in this example. Your applications should not need to include such code if they are using Assistant-generated wrappers.
Note: The following steps assume you are working on a UNIX platform. If you are working on a Windows platform, substitute the appropriate paths and path- separator characters.
- Copy the file IDLWindowExample.java from the
directory to a new directory where you will compile the Java code. In this example, we assume you will build the Java example in the /tmp/idljavatest directory.
- Change directories to the /tmp/idljavatest directory.
- Set your CLASSPATH environment variable to include both the current directory (".") and the IDL_DIR/resource/bridges/export/java/javaidlb.jar file.
Note: If you are using a UNIX-based system, use the bridge_setup file (see Using the bridge_setup File on UNIX Systems). If you are using a Windows system you must modify your classpath manually.
See Java Requirements for additional information about the class path
- Compile the IDLWindowExample.java file with the following command:
This command creates two class files: IDLWindow.class and IDLWindowExample.class.
- Execute the example code with the following command:
java IDLWindowExample <IDL_classname>
where <IDL_classname> is the name of one of the example classes described above.
For example, if you sourced the bridge_setup file and compiled the IDLWindowExample.java file in the /tmp/idljavatest directory, the following commands would execute the three examples described above:
java IDLWindowExample IDLgrWindowExample
java IDLWindowExample IDLitDirectWindowExample
java IDLWindowExample IDLitWindowExample
Using the bridge_setup File on UNIX Systems
If you are using a UNIX-based sytem, source the bridge_setup file from the bin subdirectory of the IDL installation to configure IDL properly to use the bridge. If you use a C shell:
where IDL_DIR is the path to your IDL installation. (There are bridge_setup files for the C shell, korn shell, and bash shell. Use the proper source command and bridge_setup file for your installation.)