The New AWT Event Model
Other AWT Improvements
Enterprise APIs: JDBC, RMI, and Security
New JDK Utilities
Java 1.1 is a huge new release. The number of packages in the API has increased from 8 in Java 1.0 to 23 in Java 1.1, and the number of classes has more than doubled from 211 to 503. On top of these changes to the core Java class libraries, there have been some important changes to the language itself. Also, the JDK--the Java Development Kit from Sun--includes a number of new tools in version 1.1.
The new features of Java 1.1 include:
Changes to the Java language itself to allow classes to be nested within each other, and within blocks of code.
A framework for defining reusable modular software components.
A variety of new features that make it possible to write programs that run around the globe.
A new model for handling events in graphical user interfaces that should make it easier to create those interfaces.
The Java 1.1 AWT includes support for printing, cut-and-paste, popup menus, menu shortcuts, and focus traversal. It has improved support for colors, fonts, cursors, scrolling, image manipulation, and clipping.
JAR files allow all of an applet's files to be grouped into a single archive. Digital signatures allow trusted applets to run with fewer security restrictions. The HTML <APPLET> tag has new features.
Objects can now be easily "serialized" and sent over the network or written to disk for persistent storage.
Java programs can now "reflect" upon themselves or upon an arbitrary class to determine the methods and fields defined by the class, the arguments passed to a method, and so on. The Reflection API also allows the invocation of methods specified by name.
Java 1.1 includes a new package that supports digital signatures, message digests, key management, and access control lists.
A new package that allows Java programs to send SQL queries to database servers. It includes a "bridge" that allows it to inter-operate with existing ODBC database servers.
An interface that supports distributed Java applications in which a program running on one computer can invoke methods of Java objects that exist on a different computer.
These and other new features are summarized in the sections below. Many of them are also described in more detail elsewhere in this book.
The packages and classes of the Java class library are interlinked and interdependent. Many of the major new features of Java 1.1 rely on classes from multiple packages in the Java API. Before we examine those new features in detail, therefore, we need to understand the big picture of Java 1.1. The paragraphs below discuss each of the 23 packages that constitute the core API for Java 1.1; they introduce the new packages and explain the changes to existing packages.
Despite the introduction of JAR files, digitally signed applets, and new attributes of the <APPLET> tag, the java.applet package has not changed in any significant way.
The java.awt package contains new classes and interfaces to support printing, popup menus, and menu shortcuts, and to improve support for layout management, cursors, scrolling, colors, and clipping. Several classes provide support for the new AWT event model, but most event support is contained in one of several new sub-packages of java.awt.
The classes and interfaces in this package define a generic framework for inter-application (and intra-application) data transfer. This package also includes classes to support a clipboard-based cut-and-paste data transfer model. In the future, this package may be extended to include support for data transfer through a drag-and-drop metaphor. One of the two underlying data transfer mechanisms supported by this package relies on the Object Serialization API of the java.io package.
This package defines the classes and interfaces of the new AWT event handling model. The classes and interfaces of this package fall into three categories:
All the events and event listeners defined in this package extend the EventObject class or the EventListener interface defined in java.util.
This package has two new image filter classes that implement improved image scaling. Changes have also been made to the MemoryImageSource and PixelGrabber classes.
The changes to this package for the most part simply reflect changes to java.awt. There are new interfaces that represent a platform-dependent popup menu and scrolling area, for example.
This package constitutes the much-touted JavaBeans API for creating and using embeddable, reusable software components. The classes and interfaces in this package can be used at three different levels:
Most of the classes and interfaces of the package are for use by application builders or by developers of advanced beans. Programmers using beans or writing simple beans do not need to be familiar with most of the package.
Application builders that manipulate beans rely on the Reflection API defined in java.lang.reflect, and many beans take advantage of the Object Serialization API defined in the java.io package. The JavaBeans API uses the same event model that the Java 1.1 AWT does, and event-related classes and interfaces in this package are extensions of a class and an interface defined in java.util.
The java.io package has become by far the largest of the core Java packages. This is because Java 1.1 adds:
This package has several new Exception and Error types, as well as new Byte, Short, and Void classes. With the addition of these new classes, all primitive Java data types (including the void type) have corresponding object types. This is important for the java.lang.reflect package, which defines the new Reflection API. In addition, the Class class has been greatly enhanced for use with the Reflection API. Class and ClassLoader have methods to locate "resources" associated with a class, such as images, audio files, Properties files, and so on. Resources are important for internationalization in Java 1.1.
This new package enables a Java program to examine the structure of Java classes and to "reflect upon" its own structure. java.lang.reflect contains classes that represent the fields, methods, and constructors of a class, and enable a program to obtain complete information about any object, array, method, constructor, or field. The java.beans package relies heavily upon this package.
This new package contains only two classes, which support arithmetic on arbitrary-size integers and arbitrary-precision floating-point numbers. The BigInteger class also defines methods for modular arithmetic, primality testing, and other features required for cryptography.
The changes to the java.net package are quite low-level. They include the addition of multicast sockets, Unix-style socket options, and new exception types that provide finer granularity when handling networking exceptions.
This package defines the fundamental classes and interfaces used for Remote Method Invocation. Most of the classes in this package are exception types. Subpackages of java.rmi provide additional, more specialized functionality. When objects must be passed as arguments to remote methods, RMI relies on the object serialization functionality provided in the java.io package.
This small package defines the classes and interfaces required for distributed garbage collection (DGC).
This is another small package that defines the classes and interfaces required for a Java client to look up a remote object by name or for a Java server to advertise the service it provides.
This package is the largest of the RMI packages and is at the heart of Remote Method Invocation. It defines the classes and interface that allow a Java program to create an object that can be used remotely by other Java programs.
This package contains the classes and interfaces that represent the fundamental abstractions of cryptographic security: public and private keys, certificates, message digests, and digital signatures. This package does not provide implementations of these abstractions; by design, the Java Security API is implementation independent. Java 1.1 does include a default implementation, but vendor-specific implementations may also be used in conjunction with this package. The default security implementation relies on the BigInteger class defined in the java.math package.
This package defines high-level interfaces, and some exceptions, for manipulating access control lists.
This package defines a few interfaces that are required for the Java Security API's implementation-independent design.
This package is the Java Database Connectivity (JDBC) API. The classes and interfaces it contains allow Java programs to send SQL queries to databases and retrieve the results of those queries.
The classes and interfaces in this package are used for internationalization. The package includes classes for formatting dates, times, numbers, and textual messages in a manner appropriate for the default locale, or for any specified locale. It also includes classes for collating strings according to the rules of a given locale and iterating through the characters, words, and sentences of a string in a locale-specific manner.
As its name indicates, the java.util package contains miscellaneous utility classes. In Java 1.1, new classes have been added to this package to support the AWT and Java Beans event model, to define "locales" and "resource bundles" used for internationalization, and to manipulate dates, times, and time zones.
This package implements classes for computing checksums on streams of data, and for compressing and archiving (and uncompressing and unarchiving) streams of data, using ZLIB compression library and ZIP and GZIP file formats.