Until now, the programs we have been creating have perhaps not been what you may instinctively think of as a program. We can't expect a user to know about classpaths and so on in order to run one of our programs. More traditionally, an application consists of one or more windows that the user can interact with. These windows, and the environment that the user interacts with, is known as the Graphical User Interface (GUI).
In this chapter, we will investigate how to create a window for a Java application and we will take a first look at some of the components we can put together to create a graphical user interface in Java.
You will learn:
How to create a resizable window.
What components and containers are.
How you can add components to a window.
How to control the layout of components.
How to create a menu bar and menus for a window.
What a menu shortcut is and how you can add a shortcut for a menu item.
What the restrictions on the capabilities of an applet are.
How to convert an application into an applet.