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.
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:
Course Notes >