Misplaced Pages

Java AWT Native Interface

Article snapshot taken from Wikipedia with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these messages)
This article does not cite any sources. Please help improve this article by adding citations to reliable sources. Unsourced material may be challenged and removed.
Find sources: "Java AWT Native Interface" – news · newspapers · books · scholar · JSTOR (June 2012) (Learn how and when to remove this message)
This article possibly contains original research. Please improve it by verifying the claims made and adding inline citations. Statements consisting only of original research should be removed. (June 2012) (Learn how and when to remove this message)
This article's tone or style may not reflect the encyclopedic tone used on Misplaced Pages. See Misplaced Pages's guide to writing better articles for suggestions. (June 2012) (Learn how and when to remove this message)
(Learn how and when to remove this message)

Java AWT Native Interface (JAWT) is an interface for the Java programming language that enables rendering libraries compiled to native code to draw directly to a Java Abstract Window Toolkit (AWT) Canvas object drawing surface.

The Java Native Interface (JNI) allows developers to add platform-dependent functionality to Java applications. The JNI enables developers to add time-critical operations like mathematical calculations and 3D rendering.

Previously, native 3D rendering was challenging because the native code did not have access to the graphic context. The AWT Native Interface is designed to give developers access to an AWT Canvas for direct drawing with native code. In fact, the Java 3D API extension to the standard Java SE JDK relies heavily on the AWT Native Interface to render 3D objects in Java.

The AWT Native Interface is very similar to the JNI, and the steps are the same as those of the JNI. See the Java Native Interface article for an explanation of the JNI techniques employed by the AWT Native Interface. The AWT Native Interface was added to the Java platform with the J2SE 1.3 ("Kestrel") version.

Native painting

One can paint as if it is a native application. In Windows, the JVM will pass a HWND and other window information to the native application so that the application will "know" where to draw. It could use GDI to draw a Rectangle. The window information the native side needs will be in a JAWT_Win32DrawingSurfaceInfo structure (depending on the operating system) which can be retrieved with this line: dsi_win = (JAWT_Win32DrawingSurfaceInfo*)dsi->platformInfo;

References

External links

Java desktop
APIs
Deprecated APIs
Open-source
Category:
Java AWT Native Interface Add topic