Bridges > Java and COM - IDL Objects > Drawable Object Canvas Examples

# Drawable Object Canvas Examples

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). For information about a COM example, see COM Wrapper Example.

## IDLgrWindow Example

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.

## IDLitDirectWindow Example

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.

## IDLitWindow Example

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 Macintosh OS X.

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.

1. Copy the file IDLWindowExample.java from the

IDL_DIR/examples/doc/bridges/java

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.

2. Change directories to the /tmp/idljavatest directory.
3. 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, you should 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

4. Compile the IDLWindowExample.java file with the following command:

javac IDLWindowExample.java

This command creates two class files: IDLWindow.class and IDLWindowExample.class.

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

source IDL_DIR/bin/bridge_setup

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

## COM Wrapper Example

See Tri-Window COM Export Example for the steps needed to include controls based on the three drawable objects in a Visual Basic .NET Windows application.