Bridges > Java Export Bridge > Java Wrapper Objects

# Java Wrapper Objects

There are two different types of objects created by the Java Export Bridge: drawable and non-drawable.

- Drawable wrapper objects contain a Java AWT Canvas object to which IDL draws. These wrapper objects inherit from the JIDLCanvas object.
- Nondrawable objects provide an interface between Java and IDL to call methods and pass data. However, these objects do not provide a Canvas on which IDL can draw. They inherit from the JIDLObject object.

Note: Drawable Java objects are not supported on Macintosh OS X.

JIDLCanvas objects extend java.awt.Canvas, which means that they are a heavyweight component. They will work fine with AWT components. However, Swing introduces the concept of lightweight components, which presents some issues in Java when heavyweight objects are mixed with lightweight components. (Swing does not provide a lightweight Canvas. If Swing users require the use of a Canvas, they use an awt.Canvas). Where possible, the JIDLCanvas attempts to work around these problems. However, Swing developers should be aware of them. The following article provides background on this problem and describes the various problems that may occur when mixing lightweight and heavyweight components: http://java.sun.com/products/jfc/tsc/articles/mixing/.

Java is a highly multi-threaded language, especially in GUI applications, which can lead to problems with event handling. For example, event handling can happen in a different thread from the main thread that started the GUI. Thus, a complicated GUI could start processing events after the GUI has been initialized, but before the createObject method is called to instantiate the wrapper object for client use. It is therefore important not to start handling events before a successful object creation, which can be accomplished by calling the isObjectCreated method available for all Java wrapped objects to make sure the createObject call has finished successfully.

In addition to the wrapper methods created by the Export Bridge Assistant (see Stock Java Wrapper Methods for details), exported Java objects have access to the interfaces and classes included in the IDL Java package itself. See IDL Java Object API for details.