Visit Mozilla.org

Core JavaScript 1.5 Reference:Global Objects:Packages:java

From MDC


Contents

[edit] Summary

Any class in the Java package java.*.

Property of Packages
Implemented in: JavaScript 1.1, NES2.0

[edit] Syntax

Packages.java

[edit] Description

Use the java property to access any class in the java package from within JavaScript. Note that the top-level object java is a synonym for Packages.java.

[edit] Examples

[edit] Example: Using Packages.java

The following code accesses the constructor of the java.awt.Frame class:

var theOwner = new Packages.java.awt.Frame();

You can simplify this code by using the top-level java object to access the constructor as follows:

var theOwner = new java.awt.Frame();