Windows

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 extends 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 do in an applet panel can also be done in a Window.

Normally you Don't use the Window class directly. Instead you use 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.


Previous | Next | Top | Cafe au Lait

Copyright 1997 Elliotte Rusty Harold
elharo@metalab.unc.edu
Last Modified March 24, 1997