Course Notes‎ > ‎

Chapter 6 - Java GUI Applications


Graphical User Interfaces (GUIs) are mechanisms for allowing users to enter data in the most economical and straightforward manner possible. Figure 6.1, “Example GUI: Font Dialog” shows an example GUI that is designed to allow a user to choose a font type, style and size. There are different controls such as buttons, lists, choice items and check box items. This dialog box allows the user to choose the options easily, while it also allows the programmer to carefully control the way that the user can enter the data, preventing the user from entering invalid options.

Figure 9.1. Example GUI: Font Dialog

Example GUI: Font Dialog

Java provides two mechanisms for developing user interface applications in Java - AWT and Swing. AWT (Abstract Windowing Toolkit) is the mechanism we will use here, but we will discuss Swing later. The AWT is tied directly to the operating system (Figure 6.1, “Example GUI: Font Dialog” is on the Windows OS) and so AWT applications will have a different "look-and-feel" on different operating systems.

All source code examples for this chapter are available on Github:

These notes are copyright Dr. Derek Molloy, School of Electronic Engineering, Dublin City University, Ireland 2013-present. Please contact him directly before reproducing any of the content in any way.