[英]How can i send a string from my Swing application to javascript?
i am trying to send a string from my swing application to javascript, i tried using JSObject sendIt = JSObject.getWindow(this); 我正在尝试从我的swing应用程序向javascript发送字符串,我尝试使用JSObject sendIt = JSObject.getWindow(this); but i get an the following error
但我收到以下错误
"because method getWindow in class netscape.javascript.JSObject cannot be applied to given types; required: java.applet.Applet found: work reason: actual argument work cannot be converted to java.applet.Applet by method invocation conversion" “因为无法将类netscape.javascript.JSObject中的getWindow方法应用于给定类型;必需:java.applet.Applet被发现:工作原因:实际参数工作不能通过方法调用转换转换为java.applet.Applet”
parts of my code below 我的部分代码如下
public class work extends javax.swing.JFrame {
private void uploadButtonMouseClicked (java.awt.event.MouseEvent evt) {
// System.out.println("its here");
theHash = (String) sender.uploadFunction(filesArray[i], uuid);
System.out.println("Uploading " + filesArray[i] + "\n");
JSObject sendIt = JSObject.getWindow(this); //error
}
}
You can only call JSObject.getWindow(this)
from within your Applet object, so 'this' should be a reference to an Applet object. 您只能从Applet对象中调用
JSObject.getWindow(this)
,因此“ this”应该是对Applet对象的引用。
By the way, you should enable this in your applet tag: 顺便说一句,您应该在applet标签中启用它:
<APPLET code="..." width="..." height="..." MAYSCRIPT>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.