The next few discussions will be concerned with building user interfaces in Java using the AWT. The emphasis will be on developing a familiarity with the different components that are available. We will look, first, at the components needed to build a basic application user interface. After that, we will look at handling events from components. Finally, we will look at additional user interface components and at several different layout managers that can be used to arrange components on the display.User interface components are provided through the AWT package. Most are subclasses of the
Component
class.
Task
Out task is to build a basic interface for an applet, implemented as a separate window rather than being included within a browser's window. It will be built in three steps. It will include components such as menus and scrollbars, but it will not do anything. We will add function to interpret users' actions, such a selecting a particular menu item, whenevents
are discussed in more detail in a later lesson.Step 1
The first step is to build the basic framework for the interface. It will be built as a separate window, rather than as a panel contained within the applet window.Step 2
After building the basic window, we will next add menus to the top of the window.Step 3
The third step is to build thescrollbars
and a message display area.
References
References useful for this discussion include the following::