Using The Java API Documentation
Using The Java API Documentation
© 2007 by Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved.
XI Appendix J Using the Java API Documentation
Upper-left frame Tree link displays Deprecated link Index link lists Help link
lists all packages the hierarchy of all lists portions of the fields, methods, describes how
in alphabetical packages and API that should no classes and the API is
order. classes. longer be used. interfaces. organized.
Lower-left frame lists all classes and Right frame overviews the API specification and contains descriptions
interfaces in alphabetical order. of each package. When you select a particular class or interface in the
© 2007 by Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved.
J.2 Navigating the Java API XII
Fig. J.2 | Viewing the Index page. (Courtesy of Sun Microsystems, Inc.)
© 2007 by Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved.
XIII Appendix J Using the Java API Documentation
you can click the H link to go to the alphabetical listing of all items in the Java API that
begin with "h". Scroll to method hasNextInt (Fig. J.3). Once there, each method named
hasNextInt is listed with the package name and class to which the method belongs. From
there, you can click the class name to view the class’s complete details, or you can click the
method name to view the method’s details.
Click a package name in the upper- Click the package name in the lower-
left frame to view all classes and left frame to display a summary of Contents of package javax.swing
interfaces defined in the package. that package in the right frame. are displayed in the lower-left frame.
Fig. J.4 | Clicking a package name in the upper-left frame to view all classes and interfaces
declared in this package. (Courtesy of Sun Microsystems, Inc.)
© 2007 by Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved.
J.2 Navigating the Java API XIV
when you click javax.swing in the upper-left frame. You can click the package name in
the lower-left frame to get an overview of the package. If you think that a package contains
several classes that could be useful in your application, the package overview can be espe-
cially helpful.
Click the class name to view detailed Detailed information about the class
information about the class. is displayed in the right frame.
JButton class
Interfaces
implemented by
JButton
Description of
class JButton
Fig. J.5 | Clicking a class name to view detailed information about the class. (Courtesy of Sun
Microsystems, Inc.)
© 2007 by Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved.
XV Appendix J Using the Java API Documentation
class hierarchy that leads to class JButton, the interfaces class JButton implements and the
subclasses of class JButton. The bottom of the right frame shows the beginning of class
JButton’s description. Note that when you look at the documentation for an interface, the
right frame does not display a hierarchy for that interface. Instead, the right frame lists the
interface’s superinterfaces, known subinterfaces and known implementing classes.
Field Summary
section of class
Click the field name
to go to the Field
Detail section,
which provides
additional
Fig. J.6 | Field Summary section of class Color. (Courtesy of Sun Microsystems, Inc.)
© 2007 by Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved.
J.2 Navigating the Java API XVI
Constructor
Summary
Click the
parameter type to
Fig. J.7 | Constructor Summary section of class JButton. (Courtesy of Sun Microsystems,
Inc.)
Method
Summary
Click the
method name
to go to the
Method
Detail section,
which provides
additional
© 2007 by Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved.
XVII Appendix J Using the Java API Documentation
Field Detail
section describes
the purpose of
Fig. J.9 | Field Detail section of class Color. (Courtesy of Sun Microsystems, Inc.)
2. The Constructor Detail section provides the first line of each constructor’s dec-
laration and discusses the constructors. The discussion includes the modifiers of
each constructor, a description of each constructor, each constructor’s parameters
and any exceptions thrown by each constructor. Figure J.10 shows the Construc-
tor Detail section of class JButton.
3. The Method Detail section provides the first line of each method. The discussion
of each method includes its modifiers, a more complete method description, the
method’s parameters, the method’s return type and any exceptions thrown by the
method. Figure J.11 shows the Method Detail section of class Buffered-
InputStream. The method details show you other methods that might be of in-
terest (labeled as See Also). If the method overrides a method of the superclass,
the name of the superclass method and the name of the superclass are provided
so you can link to the method or superclass for more information.
Constructor
Fig. J.10 | Constructor Detail section of class JButton. (Courtesy of Sun Microsystems,
Inc.)
© 2007 by Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved.
J.2 Navigating the Java API XVIII
Method read throws IOException. Click Method read overrides the read method in
IOException to load the IOException class FilterInputStream. Click the name of the
information page and learn more about the exception overridden method to view detailed information
type (e.g., why such an exception might be thrown). about the superclass’s version of that method.
Method
Detail
section
As you look through the documentation, you will notice that there are often links to
other fields, methods, nested-classes and top-level classes. These links enable you to jump
from the class you are looking at to another relevant portion of the documentation.
© 2007 by Pearson Education, Inc., Upper Saddle River, NJ. All Rights Reserved.