Cari di JavaScript 
    JavaScript Manual
Daftar Isi
(Sebelumnya) Chapter 14. Java packages for ...Index (Berikutnya)

netscape.javascript.JSException

The public class JSException extends Exception.

java.lang.Object
   |
   +----java.lang.Throwable
            |
            +----java.lang.Exception
                     |
                     +----netscape.javascript.JSException
JSException is an exception that is thrown when JavaScript code returns an error.

Constructors

The netscape.javascript.JSException class has the following constructors:

Table 14.3 Constructors for the JSException class

ConstructorDescription
JSException
Constructs a JSException. You specify whether the JSException has a detail message and other information.

The following sections show the declaration and usage of these constructors.

JSException

Constructor. Constructs a JSException. You specify whether the JSException has a detail message and other information.

Declaration

1. public JSException()
2. public JSException(String s)
3. public JSException(String s,
   String filename,
   int lineno,
   String source,
   int tokenIndex)

Arguments

s
The detail message.

filename
The URL of the file where the error occurred, if possible.

lineno
The line number if the file, if possible.

source
The string containing the JavaScript code being evaluated.

tokenIndex
The index into the source string where the error occurred.

Description

A detail message is a string that describes this particular exception.

Each form constructs a JSException with different information:

  • Form 1 of the declaration constructs a JSException without a detail message.
  • Form 2 of the declaration constructs a JSException with a detail message.
  • Form 3 of the declaration constructs a JSException with a detail message and all the other information that usually comes with a JavaScript error.

netscape.plugin.Plugin

The public class Plugin extends Object.

java.lang.Object
   |
   +----netscape.plugin.Plugin
This class represents the Java reflection of a plug-in. Plug-ins that need to have Java methods associated with them should subclass this class and add new (possibly native) methods to it. This allows other Java entities (such as applets and JavaScript code) to manipulate the plug-in.

Constructors and methods

The netscape.plugin.Plugin class has the following constructors:

Table 14.4 Constructors for the Plugin class

ConstructorDescription
Plugin
Constructs a Plugin.

The netscape.plugin.Plugin class has the following methods:

Table 14.5 Methods for the Plugin class

MethodDescription
destroy
Called when the plug-in is destroyed

getPeer
Returns the native NPP object--the plug-in instance that is the native part of a Java Plugin object

getWindow
Returns the JavaScript window on which the plug-in is embedded

init
Called when the plug-in is initialized

isActive
Determines whether the Java reflection of a plug-in still refers to an active plug-in

The following sections show the declaration and usage of these constructors and methods.

destroy

Method. Called when the plug-in is destroyed. You never need to call this method directly, it is called when the plug-in is destroyed. At the point this method is called, the plug-in will still be active.

Declaration

public void destroy()

See also

init

getPeer

Method. Returns the native NPP object--the plug-in instance that is the native part of a Java Plugin object. This field is set by the system, but can be read from plug-in native methods by calling:

NPP npp = (NPP)netscape_plugin_Plugin_getPeer(env, thisPlugin);

Declaration

public int getPeer()

getWindow

Method. Returns the JavaScript window on which the plug-in is embedded.

Declaration

public JSObject getWindow()

init

Method. Called when the plug-in is initialized. You never need to call this method directly, it is called when the plug-in is created.

Declaration

public void init()

See also

destroy

isActive

Method. Determines whether the Java reflection of a plug-in still refers to an active plug-in. Plug-in instances are destroyed whenever the page containing the plug-in is left, thereby causing the plug-in to no longer be active.

Declaration

public boolean isActive()

Plugin

Constructor. Constructs a Plugin.

Declaration

public Plugin()
(Sebelumnya) Chapter 14. Java packages for ...Index (Berikutnya)