IcedTea-Web Plugin

## netscape.javascript
Class JSObject

    java.lang.Object
      netscape.javascript.JSObject

    public final class JSObject

extends java.lang.Object

JSObject allows Java to manipulate objects that are defined in JavaScript. Values passed from Java to JavaScript are converted as follows:

- JSObject is converted to the original JavaScript object
- Any other Java object is converted to a JavaScript wrapper, which can be used to access methods and fields of the java object. Converting this wrapper to a string will call the toString method on the original object, converting to a number will call the doubleValue method if possible and fail otherwise. Converting to a boolean will try to call the booleanValue method in the same way.
- Java arrays are wrapped with a JavaScript object that understands array.length and array[index]
- A Java boolean is converted to a JavaScript boolean
- Java byte, char, short, int, long, float, and double are converted to JavaScript numbers

Values passed from JavaScript to Java are converted as follows:

- objects which are wrappers around java objects are unwrapped
- other objects are wrapped with a JSObject
- strings, numbers and booleans are converted to String, Double, and Boolean objects respectively

This means that all JavaScript values show up as some kind of java.lang.Object in Java. In order to make much use of them, you will have to cast them to the appropriate subclass of Object, e.g. `(String) window.getMember("name");` or `(JSObject) window.getMember("document");`.

Constructor Summary
`JSObject(int jsobj_addr)` it is illegal to construct a JSObject manually
`JSObject(long jsobj_addr)`
`JSObject(java.lang.String jsobj_addr)` it is illegal to construct a JSObject manually

Method Summary
`java.lang.Object` `call(java.lang.String methodName, java.lang.Object[] args)` Calls a JavaScript method.
`java.lang.Object` `eval(java.lang.String s)` Evaluates a JavaScript expression.
`protected void` `finalize()` Finalization decrements the reference count on the corresponding JavaScript object.
`java.lang.Object` `getMember(java.lang.String name)` Retrieves a named member of a JavaScript object.
`java.lang.Object` `getSlot(int index)` Retrieves an indexed member of a JavaScript object.
`static JSObject` `getWindow(java.applet.Applet applet)` get a JSObject for the window containing the given applet
`void` `removeMember(java.lang.String name)` Removes a named member of a JavaScript object.
`void` `setMember(java.lang.String name, java.lang.Object value)` Sets a named member of a JavaScript object.
`void` `setSlot(int index, java.lang.Object value)` Sets an indexed member of a JavaScript object.
`java.lang.String` `toString()` Converts a JSObject to a String.

Methods inherited from class java.lang.Object
`clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### JSObject

    public JSObject(int jsobj_addr)

  it is illegal to construct a JSObject manually

### JSObject

    public JSObject(java.lang.String jsobj_addr)

  it is illegal to construct a JSObject manually

### JSObject

    public JSObject(long jsobj_addr)

Method Detail

### getMember

    public java.lang.Object getMember(java.lang.String name)

  Retrieves a named member of a JavaScript object. Equivalent to "this.name" in JavaScript.

### getSlot

    public java.lang.Object getSlot(int index)

  Retrieves an indexed member of a JavaScript object. Equivalent to "this[index]" in JavaScript.

### setMember

    public void setMember(java.lang.String name,
                          java.lang.Object value)

  Sets a named member of a JavaScript object. Equivalent to "this.name = value" in JavaScript.

### setSlot

    public void setSlot(int index,
                        java.lang.Object value)

  Sets an indexed member of a JavaScript object. Equivalent to "this[index] = value" in JavaScript.

### removeMember

    public void removeMember(java.lang.String name)

  Removes a named member of a JavaScript object.

### call

    public java.lang.Object call(java.lang.String methodName,
                                 java.lang.Object[] args)

  Calls a JavaScript method. Equivalent to "this.methodName(args[0], args[1], ...)" in JavaScript.

### eval

    public java.lang.Object eval(java.lang.String s)

  Evaluates a JavaScript expression. The expression is a string of JavaScript source code which will be evaluated in the context given by "this".

### toString

    public java.lang.String toString()

  Converts a JSObject to a String.

  Overrides:
    `toString` in class `java.lang.Object`

### getWindow

    public static JSObject getWindow(java.applet.Applet applet)

  get a JSObject for the window containing the given applet

### finalize

    protected void finalize()

  Finalization decrements the reference count on the corresponding JavaScript object.

  Overrides:
    `finalize` in class `java.lang.Object`

IcedTea-Web Plugin

Submit a bug or feature