133 * "this[index] = value" in JavaScript.
134 *
135 * @param index The index of the array to be accessed.
136 * @param value The value to set
137 * @throws JSException when an error is reported from the browser or
138 * JavaScript engine.
139 */
140 public abstract void setSlot(int index, Object value) throws JSException;
141
142 /**
143 * Returns a JSObject for the window containing the given applet. This
144 * method only works when the Java code is running in a browser as an
145 * applet. The object returned may be used to access the HTML DOM directly.
146 *
147 * @param applet The applet.
148 * @return JSObject representing the window containing the given applet or
149 * {@code null} if we are not connected to a browser.
150 * @throws JSException when an error is reported from the browser or
151 * JavaScript engine or if applet is {@code null}
152 *
153 * @deprecated The Applet API is deprecated. See the
154 * <a href="{@docRoot}/java.desktop/java/applet/package-summary.html">
155 * java.applet package documentation</a> for further information.
156 */
157
158 @Deprecated(since = "9")
159 @SuppressWarnings("exports")
160 public static JSObject getWindow(Applet applet) throws JSException {
161 return ProviderLoader.callGetWindow(applet);
162 }
163
164 private static class ProviderLoader {
165 private static final JSObjectProvider provider;
166
167 static {
168 provider = AccessController.doPrivileged(
169 new PrivilegedAction<>() {
170 @Override
171 public JSObjectProvider run() {
172 Iterator<JSObjectProvider> providers =
173 ServiceLoader.loadInstalled(JSObjectProvider.class).iterator();
174 if (providers.hasNext()) {
175 return providers.next();
176 }
177 return null;
178 }
|
133 * "this[index] = value" in JavaScript.
134 *
135 * @param index The index of the array to be accessed.
136 * @param value The value to set
137 * @throws JSException when an error is reported from the browser or
138 * JavaScript engine.
139 */
140 public abstract void setSlot(int index, Object value) throws JSException;
141
142 /**
143 * Returns a JSObject for the window containing the given applet. This
144 * method only works when the Java code is running in a browser as an
145 * applet. The object returned may be used to access the HTML DOM directly.
146 *
147 * @param applet The applet.
148 * @return JSObject representing the window containing the given applet or
149 * {@code null} if we are not connected to a browser.
150 * @throws JSException when an error is reported from the browser or
151 * JavaScript engine or if applet is {@code null}
152 *
153 * @deprecated The Applet API is deprecated, no replacement. See the
154 * <a href="{@docRoot}/java.desktop/java/applet/package-summary.html">
155 * java.applet package documentation</a> for further information.
156 */
157
158 @Deprecated(since="9", forRemoval=true)
159 @SuppressWarnings("exports")
160 public static JSObject getWindow(Applet applet) throws JSException {
161 return ProviderLoader.callGetWindow(applet);
162 }
163
164 private static class ProviderLoader {
165 private static final JSObjectProvider provider;
166
167 static {
168 provider = AccessController.doPrivileged(
169 new PrivilegedAction<>() {
170 @Override
171 public JSObjectProvider run() {
172 Iterator<JSObjectProvider> providers =
173 ServiceLoader.loadInstalled(JSObjectProvider.class).iterator();
174 if (providers.hasNext()) {
175 return providers.next();
176 }
177 return null;
178 }
|