0 votes
in JAVA by

The AWT (Abstract Window Toolkit) provides an interface between a Java application and a native windowing system. AWT comprises the event handling system as well as a set of so-called heavyweight GUI components, including the top-level components such as frames and dialogs. It also has a simple set of widgets for use in situations where next level of more sophisticated GUI tools is not available.

AWT has a very old code base, and has a complicated structure. Parts of the code are intermingled with other low-level parts of JDK such as 2D, i18n, and Input Methods. The majority of the AWT code consists of the directories shown below.

  • src/share/classes/java/awt:
    Contains public API thoroughly specified in java.sun.com/javase/6/docs/technotes/guides/awt/index.html. To rebuild after a small change, go to make/java/awt. The result is a set of classes regularly packed in rt.jar.

  • src/share/classes/sun/awt:
    Contains API that is more volatile and not well documented. This has traditionally not been considered public API. Generally, an application developer should not use it.To rebuild after a small change, go to make/sun/awt. Changes here may require rebuilding of classes and certain libraries, for example splashscreen and awt.dll.

  • src/solaris/classes/sun/awt and src/windows/classes/sun/awt:
    Contains low-level implementation of the AWT Toolkits: XToolkit for X Window-based systems, and WToolkit for MS Windows, and also the headless toolkit. Here you will also find code for MToolkit, requiring a proprietary Motif library. However, this is considered obsolete and isn't built as part of OpenJDK. For partial rebuilding you should start from make/sun/awt and/or make/sun/xawt. Classes, awt.dll, and mawt.so will be rebuilt in case of changes.

The native parts of the code base are written in C and C++. Most of the code is platform-specific and resides in the corresponding directories: src/solaris/ or src/windows/

  • src/share/native/sun/awt:
    Currently only the splashscreen subdirectory is a part of AWT proper.
    For small changes made here, you can rebuild from make/sun/awt or make/sun/xawt, depending on the platform.

  • src/solaris/native/sun/awt:
    A significant part of this code was used to build MToolkit. Certain parts of it are still in use, however. To rebuild go to make/sun/awt or make/sun/xawt. Note that some of the code here leads to dead ends!

  • src/solaris/native/sun/xawt
    Contains a native part of XToolkit, AWT Toolkit for X Windows. It's not a large subsection, since most of XToolkit is written in Java. To rebuild go to make/sun/xawt.

  • src/windows/native/sun/windowssrc/windows/native/sun/awt_common and src/windows/native/sun/awt
    A part of the code for MS Windows

Related questions

+1 vote
asked May 24, 2019 in JAVA by rajeshsharma
0 votes
asked May 7, 2021 in JAVA by sharadyadav1986
...