The Java language has its objects organized in the following packages:
java.lang
Package that contains essential Java classes, including numerics,
strings, objects, compiler, runtime, security, and threads. This is the only package that
is automatically imported into every Java program.
java.io
Package that provides classes to manage input and output streams to read
data from and write data to files, strings, and other sources.
java.awt
Package that provides an integrated set of classes to manage user
interface components such as windows, dialog boxes, buttons, checkboxes, lists, menus,
scrollbars, and text fields. (AWT = Abstract Window Toolkit)
java.util
Package that contains miscellaneous utility classes, including generic
data structures, bit sets, time, date, string manipulation, random number generation,
system properties, notification, and enumeration of data structures.
java.net
Package that provides classes for network support, including URLs, TCP
sockets, UDP sockets, IP addresses, and a binary-to-text converter.
java.awt.image
Package that provides classes for managing image data, including color
models, cropping, color filtering, setting pixel values, and grabbing
snapshots.
java.awt.peer
Package that connects AWT components to their platform-specific
implementations (such as Motif widgets or Microsoft Windows controls).
java.applet
Package that enables the creation of applets through the Applet class.
It also provides several interfaces that connect an applet to its document and to
resources for playing audio.
Before you can use any of the classes in these packages, you need
to import the object, or objects, using the import statement. For example:
will import the Graphics and Button classes from the java.awt package,
and all classes in the java.applet packages. You can also create your own packages, but we
will not do that for a while. For now, we will be concerned with some of the basic classes
we need to understand to create reasonably nice Java programs. One of the basic classes to
create standalone Java programs is the Frame class. A Frame is the basic Java version of a
Window, complete with close boxes, resizable, and menu bar, if desired. Most standalone
programs have at least one frame object. Here is the definition of the Frame class with
some of its methods:
public class java.awt.Frame extends java.awt.Window
implements java.awt.MenuContainer
{ // Constructors
public Frame();
public Frame(String title);
// Selected Methods
public void dispose();
public MenuBar getMenuBar();
public String getTitle();
public void setMenuBar(MenuBar mb);
public void setTitle(String title);
}