Availability
Netscape 3 LiveConnect
Synopsis
package.package_name // Refers to another JavaPackagepackage.class_name // Refers to a JavaClass object
Properties
The properties of a JavaPackage object are the names of the
JavaPackage objects and JavaClass objects that it contains. These
properties are different for each individual JavaPackage. Note that
it is not possible to use the JavaScript for/in
loop to iterate over the list of property names of a Package object.
Consult a Java reference manual to determine the packages and classes
contained within any given package.
Description
The JavaPackage object is a JavaScript representation of a Java
package. A package in Java is a collection of related classes. In
JavaScript, a JavaPackage can contain classes (represented by the
JavaClass object) and other JavaPackage objects.
The Window object has properties java,
netscape, and sun that
represent the java.* ,
netscape.* , and sun.*
package hierarchies. These JavaPackage objects define properties that
refer to other JavaPackage objects. For example,
java.lang and java.net refer to
the java.lang and java.net
packages. The java.awt JavaPackage contains
properties named Frame and
Button, which are both references to JavaClass
objects and represent the classes java.awt.Frame
and java.awt.Button .
The Window object also defines a property named
Packages, which is the root JavaPackage whose
properties refer to the roots of all known package hierarchies. For
example, the expression Packages.java.awt is the
same as java.awt.
It is not possible to use the for/in loop to
determine the names of the packages and classes contained within a
JavaPackage. You must have this information in advance. You can find
it in any Java reference manual or by examining the Java class
hierarchy.
See Chapter 22 for further details on working with
Java packages, classes, and objects.
See Also
JavaArray, JavaClass, JavaObject; the java,
netscape, sun, and
Packages properties of the Window object; Chapter 22
•
Table of Contents
•
Index
•
Reviews
•
Examples
•
Reader Reviews
•
Errata
JavaScript: The Definitive Guide, 4th Edition
By
David Flanagan
Publisher
: O'Reilly
Pub Date
: November 2001
ISBN
: 0-596-00048-0
Pages
: 936
Slots
: 1
This fourth edition of the definitive reference to
JavaScript, a scripting language that can be embedded
directly in web pages, covers the latest version of the
language, JavaScript 1.5, as supported by Netscape 6 and
Internet Explorer 6. The book also provides complete
coverage of the W3C DOM standard (Level 1 and Level 2),
while retaining material on the legacy Level 0 DOM for
backward compatibility.