Brought to you by EarthWeb
ITKnowledge Logo Login Graphic Click Here!
Click Here!
ITKnowledge
Find:
 
EXPERT SEARCH ----- nav

EarthWeb Direct

EarthWeb Direct

EarthWeb sites: other sites

Previous Table of Contents Next


The Table Package: javax.swing.table

The Table package contains classes and interfaces specific to the Swing table component, JTable. It contains the TableColumnModel and TableModel interfaces, as well as interfaces that define rendering and editing components for a table. There are also default implementations of each of these interfaces in this package. Simple tables can be created and used without knowledge of the interfaces or classes in this package. To utilize the full capabilities of the JTable component, however, the classes and interfaces contained in this package must be understood. An example of a Swing table is shown in Figure 1.5. A complete description of the JTable component and the support classes contained in this package is presented in Chapter 12, “Table Component.”


Figure 1.5  The Swing table component.

The Text Package: javax.swing.text

The Text package contains classes and interfaces for the rich set of text manipulation components contained in the Swing toolkit. These include the various document and document support interfaces, as well as default implementations of these interfaces. The Text package also contains two child packages, the javax.swing.text.html package for HTML content and the javax.swing.text.rtf package for rich text format content. A complete overview of the text features in the JFC is presented in Chapter 7, “Text Components.”

The Tree Package: javax.swing.tree

This package contains classes that are used with the Swing tree component, JTree (see Figure 1.6). The TreeModel and various node interfaces are defined in this package, as well as default implementations of each interface. The JTree component may be used to create simple trees without knowledge of the interfaces and classes contained in this package. To take full advantage of the JTree component, the interfaces and classes in this package must be understood. A complete description of the JTree component and its supporting classes contained in this package is presented in Chapter 11, “Tree Component.”


Figure 1.6  The Swing tree component.

The Undo Package: javax.swing.undo

The Undo package contains the interfaces and classes required to implement the undo functionality in JFC applications. This allows for an application to easily add Undo and Redo functionality. A complete description of the Undo and Redo features of the JFC is presented in Chapter 28, “Undo and Redo.”

Drag and Drop

The JFC drag-and-drop capabilities allow the transfer of data between Java applications, as well as Java to native applications. A component may be a drag source, a drop target, or both. As is common with well-written Java toolkits, interfaces define the methods required to be a drag source or drop target. Implementing these interfaces allows the component to participate in a drag operation.

An unusual aspect of drag-and-drop in the Java environment is flavor maps. A flavor map is a mapping between the device-dependent data type and the Java device-independent data type. This allows a Java application to transfer data with a native application without requiring the Java application to know the specifics about the native data types.

The Drag and Drop Package: java.awt.dnd

This package consists of four interfaces and fourteen classes that define drag-and-drop operations. There is an interface that a drag source and a drop target must implement, as well as an interface for the data flavors that can be transferred. A complete drag-and-drop example is given in Chapter 34, “Drag and Drop.”

Accessibility

The Java Accessibility API provides the framework for JFC applications to interact with assistive technologies. A properly written JFC application can be executed by assistive technologies such as Braille terminals and screen readers just as easily as it is run on conventional computers.

The Accessibility Package: javax.accessibility

The Accessibility package consists of eight interfaces and five classes. It contains the Accessible interface that is the main interface for the JFC Accessibility package. Any accessible component must implement this interface. The Accessibility package is presented in Chapter 33, ”Accessibility.”

Summary

The Java Foundation Classes provide a lightweight extension to the original AWT toolkit contained in the Java Virtual Machine. The user-interface portion of the JFC was developed under the codename Swing. The name has stuck, and these packages are still known as the Swing packages. Although these packages consist of over 250 classes and 75 interfaces, learning how to use the JFC is not an insurmountable task. These classes are divided into user interface (UI) classes, known as the J classes, and non-user interface (non-UI) classes. The UI classes contain a visual representation that can be used to interact with the user. The combination of instances of these classes is used to develop a complete graphical user interface. The non-UI classes provide support for the UI classes. Examples of non-UI classes include the Swing Event class and the model classes. These classes will be explored and their use demonstrated in the remainder of this book.


Previous Table of Contents Next
HomeAbout UsSearchSubscribeAdvertising InfoContact UsFAQs
Use of this site is subject to certain Terms & Conditions.
Copyright (c) 1996-1999 EarthWeb Inc. All rights reserved. Reproduction in whole or in part in any form or medium without express written permission of EarthWeb is prohibited. Read EarthWeb's privacy statement.