I've been searching for detailed information regarding the fundamentals of the AWT package. Specifically how it interacts natively with the host OS to create Windows and their contents.
Can anyone point me to this kind of documentation or provide any other information?
OpenJDK source is the way to go. You just need to hit the correct folder. You can see inside code like this:
checkbox = new AwtCheckbox();
...
checkbox->CreateHWnd(env, labelStr, style, exStyle,
x, y, width, height,
awtParent->GetHWnd(),
reinterpret_cast<HMENU>(static_cast<INT_PTR>(
awtParent->CreateControlID())),
::GetSysColor(COLOR_WINDOWTEXT),
::GetSysColor(COLOR_BTNFACE),
peer);
CreateHWnd
function can be found in awt_Component.cpp file, where it calls CreateWindowEx
function.
Basic:
Most GUI class libraries in C++ are platform specific, not just because of different hardware capabilities,
but subtle differences between the "look-and-feel" of various Windowing operating systems.
The Java Abstract Window Toolkit provides a cross-platform library
which seeks to observe look-and-feel conventions of various OS platforms.
Toolkit ------------------------------------------------ AWT
--------|---------
Button List JVM
------|-------------|--------------------------------------------------
Button Peer List Peer Native GUI (Windows, Mac, X)
More information about Java GUI Event Programming
AWT provides two levels of APIs:
A general interface between Java and the native system, used for windowing, events, and layout managers. This API is at the core of Java GUI programming and is also used by Swing and Java 2D. It contains:
A basic set of GUI widgets such as buttons, text boxes, and menus.
It also provides the AWT Native Interface, which enables rendering libraries compiled to native code to draw directly to an AWT Canvas object drawing surface.
AWT also makes some higher level functionality available to applications, such as:
Access to the system tray on supporting systems; and
The ability to launch some desktop applications such as web browsers and email clients from a Java application.
To get the Source code for the Native OpenJDK AWT classes use below link
jdk6/jdk6-gate/jdk/src/windows/native/sun/
jdk6/jdk6-gate/jdk/src/windows/native/sun/windows/(Windows-AWT-Native classes).
OpenJDK(GPL)
Reference:
[OpenJDK Repositories.]
Open jdk6/jdk6-gate/jdk/src/share/classes/java/awt/ (Example AWT Package Source code)
The main OpenJDK project, which is based on JDK 7
You can find out OpenJDK features here
Caciocavallo, Project that provides an OpenJDK-based Java API to ease AWT implementation on new systems.The project has successfully implemented AWT widgets using Java2D.
[OpenJDK Mailing list.]
Read AWT Documentation to get Clear knowledge on it's implementations.
Fallow awt-dev Mailing Lists to get involved.
It is an implementation detail. The defacto standard would be how Oracle has implemented it. If you really really want to know then take a look at the source code. It can be found at http://openjdk.java.net/ . The links are in the left column below the search box. The relevant classes should be in the sun.awt
package.
Well there is pdf (mentioned below).... but for me it is quite hard to understand. But it may be helpful to you.
How Java Programs Interact with Virtual Machines at the Microarchitectural Level.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With