- java.lang.Object
- 
- netscape.javascript.JSObject
 
- 
 public abstract class JSObject extends Object Allows Java code to manipulate JavaScript objects. When a JavaScript object is passed or returned to Java code, it is wrapped in an instance of JSObject. When aJSObjectinstance is passed to the JavaScript engine, it is unwrapped back to its original JavaScript object. TheJSObjectclass provides a way to invoke JavaScript methods and examine JavaScript properties.Any data returned from the JavaScript engine to Java is converted to Java data types. Certain data passed to the JavaScript engine is converted to JavaScript data types. 
- 
- 
Constructor SummaryConstructors Modifier Constructor Description protectedJSObject()Constructs a new JSObject.
 - 
Method SummaryAll Methods Static Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract Objectcall(String methodName, Object... args)Calls a JavaScript method.abstract Objecteval(String s)Evaluates a JavaScript expression.abstract ObjectgetMember(String name)Retrieves a named member of a JavaScript object.abstract ObjectgetSlot(int index)Retrieves an indexed member of a JavaScript object.static JSObjectgetWindow(Applet applet)Deprecated.The Applet API is deprecated.abstract voidremoveMember(String name)Removes a named member of a JavaScript object.abstract voidsetMember(String name, Object value)Sets a named member of a JavaScript object.abstract voidsetSlot(int index, Object value)Sets an indexed member of a JavaScript object.
 
- 
- 
- 
Method Detail- 
callpublic abstract Object call(String methodName, Object... args) throws JSException Calls a JavaScript method. Equivalent to "this.methodName(args[0], args[1], ...)" in JavaScript.- Parameters:
- methodName- The name of the JavaScript method to be invoked.
- args- the Java objects passed as arguments to the method.
- Returns:
- Result of the method.
- Throws:
- JSException- when an error is reported from the browser or JavaScript engine.
 
 - 
evalpublic abstract Object eval(String s) throws JSException Evaluates a JavaScript expression. The expression is a string of JavaScript source code which will be evaluated in the context given by "this".- Parameters:
- s- The JavaScript expression.
- Returns:
- Result of the JavaScript evaluation.
- Throws:
- JSException- when an error is reported from the browser or JavaScript engine.
 
 - 
getMemberpublic abstract Object getMember(String name) throws JSException Retrieves a named member of a JavaScript object. Equivalent to "this.name" in JavaScript.- Parameters:
- name- The name of the JavaScript property to be accessed.
- Returns:
- The value of the propery.
- Throws:
- JSException- when an error is reported from the browser or JavaScript engine.
 
 - 
setMemberpublic abstract void setMember(String name, Object value) throws JSException Sets a named member of a JavaScript object. Equivalent to "this.name = value" in JavaScript.- Parameters:
- name- The name of the JavaScript property to be accessed.
- value- The value of the propery.
- Throws:
- JSException- when an error is reported from the browser or JavaScript engine.
 
 - 
removeMemberpublic abstract void removeMember(String name) throws JSException Removes a named member of a JavaScript object. Equivalent to "delete this.name" in JavaScript.- Parameters:
- name- The name of the JavaScript property to be removed.
- Throws:
- JSException- when an error is reported from the browser or JavaScript engine.
 
 - 
getSlotpublic abstract Object getSlot(int index) throws JSException Retrieves an indexed member of a JavaScript object. Equivalent to "this[index]" in JavaScript.- Parameters:
- index- The index of the array to be accessed.
- Returns:
- The value of the indexed member.
- Throws:
- JSException- when an error is reported from the browser or JavaScript engine.
 
 - 
setSlotpublic abstract void setSlot(int index, Object value) throws JSExceptionSets an indexed member of a JavaScript object. Equivalent to "this[index] = value" in JavaScript.- Parameters:
- index- The index of the array to be accessed.
- value- The value to set
- Throws:
- JSException- when an error is reported from the browser or JavaScript engine.
 
 - 
getWindow@Deprecated(since="9") public static JSObject getWindow(Applet applet) throws JSException Deprecated.The Applet API is deprecated. See the java.applet package documentation for further information.Returns a JSObject for the window containing the given applet. This method only works when the Java code is running in a browser as an applet. The object returned may be used to access the HTML DOM directly.- Parameters:
- applet- The applet.
- Returns:
- JSObject representing the window containing the given applet or
 nullif we are not connected to a browser.
- Throws:
- JSException- when an error is reported from the browser or JavaScript engine or if applet is- null
 
 
- 
 
-