Chapter 17: Windows, Frames, Dialogs and Menus

The java.awt.Window class and its subclasses let you create free-standing windows. Stand-alone windows can also be used to build applications that use the AWT instead of the command-line or to provide additional space for applets. A Window is a subclass of java.awt.Container that is independent of other Containers. That is, a Window is not itself contained. Since Window is a subclass of java.awt.Container you can add Components like Buttons and TextFields to Windows. You can arrange the Components you add with a LayoutManager. You can draw directly into a Window in a paint method. Everything you did in an applet panel in the last five chapters can also be done in a Window.

Normally you won't use the Window class directly but will access one of its subclasses, either java.awt.Frame or java.awt.Dialog depending on your need. A Frame is what most people think of as a window in their native environment. It can have a menu bar; it can be independently moved and resized; and it will hang around on the screen as long as the user is interested in the content of the window.

A Dialog will not have a menu bar. It can be moved but often can't be resized. Its purpose is to get some particular information from the user (input) or to impart some particularly important information to the user (output). It is normally visible on the screen only until it gets the input or receives acknowledgement from the user about its output.

In this chapter you learn

The Examples


Examples from Other Chapters
[ Cafe Au Lait | Books | Trade Shows | Links | FAQ | Tutorial | User Groups ]
Copyright 1996 Elliotte Rusty Harold
elharo@sunsite.unc.edu
Last Modified September 17, 1996