gpt4 book ai didi

internet-explorer - 无法使用 Internet Explorer 第二次(重新启动)启动 JavaFX Web 应用程序

转载 作者:行者123 更新时间:2023-12-02 03:40:07 25 4
gpt4 key购买 nike

当我尝试在 Web 上重新启动 JavaFX 应用程序(第二次调用)时,我遇到了 IE 问题。这只发生在 IE 中。问题是我收到了两次证书通知,但我期望的是一次 ..

一个例子:我正在做的是退出应用程序(按下按钮时)(请参阅下面的 java 代码)并在 JS 上调用 launchit ..

我的 html :

<html><head>

<script language="JavaScript" src="./web-files/dtjava.js"></script>

<script>





function launchit(){

dtjava.embed(
{
url : 'Simple_reLaunchJFX.jnlp',
placeholder : 'javafx-app-placeholder',
width : 800,
height : 600,
jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4w..........pubHA+DQo='
},
{
javafx : '2.2+'
},
{}
);


dtjava.addOnloadCallback(javafxEmbed);
}
</script>

</head><body>
<h2>__</h2>


<a href='#' onclick="launchit();">start JFX</a><br><hr><br>

<br>

<!-- Applet will be inserted here -->
<div id='javafx-app-placeholder'></div>
</body></html>

Java:

package simple_relaunchjfx;

import javafx.application.Application;
import javafx.application.Platform;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;

/**
*
* @author maher
*/
public class Simple_reLaunchJFX extends Application {

@Override
public void start(final Stage primaryStage) {
Button btn = new Button();
btn.setText("Say 'Hello World'");


StackPane root = new StackPane();
root.getChildren().add(btn);

Scene scene = new Scene(root, 300, 250);

primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();



btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
public void handle(ActionEvent event) {
System.out.println("Hello World!");
try {
primaryStage.close();
Platform.exit();
System.exit(0);
} catch (Exception ex) {
System.err.println("error " + ex.getMessage());
}
}
});
}

/**
* The main() method is ignored in correctly deployed JavaFX application.
* main() serves only as fallback in case the application can not be
* launched through deployment artifacts, e.g., in IDEs with limited FX
* support. NetBeans ignores main().
*
* @param args the command line arguments
*/
public static void main(String[] args) {
launch(args);
}
}

最佳答案

终于解决了..

我只是在运行时通过调用动态创建另一个持有者(div)

addElement(count);

然后打电话

dtjava.addOnloadCallback(javafxEmbed);

javafxEmbed 引用了 holder div 的新 id

这将同时导致多个持有人 (div) @ ..我试图删除以前的持有人 ..但这并没有解决问题..IE 显示 2 个提示..

但这还没有结束 :) 我只是在创建调用 JavaFX 的新实例后隐藏了之前的 div

hidepreviousElement(count-1)

我将所有方法都包含在一个中:

function launchit(){
count=count+1;

addElement(count);
dtjava.addOnloadCallback(javafxEmbed);
hidepreviousElement(count-1);
}

我知道有多种方法可以添加/删除 .. 我只是使用被认为与常见浏览器 IE/FF/Chrome 兼容的方法..

<html><head>

<script language="JavaScript" src="./web-files/dtjava.js"></script>

<script>

var count=1;
function javafxEmbed() {
dtjava.embed(
{
url : 'Simple_reLaunchJFX_1_002.jnlp',
placeholder : 'javafx-app-placeholder'+count,
width : 800,
height : 600,
jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iU2ltcGxlX3JlTGF1bmNoSkZYXzFfMDAyLmpubHAiPg0KICA8aW5mb3JtYXRpb24+DQogICAgPHRpdGxlPlNpbXBsZV9yZUxhdW5jaEpGWF8xXzAwMjwvdGl0bGU+DQogICAgPHZlbmRvcj5tYWhlcjwvdmVuZG9yPg0KICAgIDxkZXNjcmlwdGlvbj5udWxsPC9kZXNjcmlwdGlvbj4NCiAgICA8b2ZmbGluZS1hbGxvd2VkLz4NCiAgPC9pbmZvcm1hdGlvbj4NCiAgPHJlc291cmNlcz4NCiAgICA8amZ4OmphdmFmeC1ydW50aW1lIHZlcnNpb249IjIuMisiIGhyZWY9Imh0dHA6Ly9qYXZhZGwuc3VuLmNvbS93ZWJhcHBzL2Rvd25sb2FkL0dldEZpbGUvamF2YWZ4LWxhdGVzdC93aW5kb3dzLWk1ODYvamF2YWZ4Mi5qbmxwIi8+DQogIDwvcmVzb3VyY2VzPg0KICA8cmVzb3VyY2VzPg0KICAgIDxqMnNlIHZlcnNpb249IjEuNisiIGhyZWY9Imh0dHA6Ly9qYXZhLnN1bi5jb20vcHJvZHVjdHMvYXV0b2RsL2oyc2UiLz4NCiAgICA8amFyIGhyZWY9IlNpbXBsZV9yZUxhdW5jaEpGWF8xXzAwMi5qYXIiIHNpemU9IjIwODQ5IiBkb3dubG9hZD0iZWFnZXIiIC8+DQogIDwvcmVzb3VyY2VzPg0KPHNlY3VyaXR5Pg0KICA8YWxsLXBlcm1pc3Npb25zLz4NCjwvc2VjdXJpdHk+DQogIDxhcHBsZXQtZGVzYyAgd2lkdGg9IjgwMCIgaGVpZ2h0PSI2MDAiIG1haW4tY2xhc3M9ImNvbS5qYXZhZngubWFpbi5Ob0phdmFGWEZhbGxiYWNrIiAgbmFtZT0iU2ltcGxlX3JlTGF1bmNoSkZYXzFfMDAyIiA+DQogICAgPHBhcmFtIG5hbWU9InJlcXVpcmVkRlhWZXJzaW9uIiB2YWx1ZT0iMi4yKyIvPg0KICA8L2FwcGxldC1kZXNjPg0KICA8amZ4OmphdmFmeC1kZXNjICB3aWR0aD0iODAwIiBoZWlnaHQ9IjYwMCIgbWFpbi1jbGFzcz0ic2ltcGxlX3JlbGF1bmNoamZ4LlNpbXBsZV9yZUxhdW5jaEpGWCIgIG5hbWU9IlNpbXBsZV9yZUxhdW5jaEpGWF8xXzAwMiIgLz4NCiAgPHVwZGF0ZSBjaGVjaz0iYWx3YXlzIi8+DQo8L2pubHA+DQo='
},
{
javafx : '2.2+'
},
{

}
);

}


function launchit(){
count=count+1;

addElement(count);
dtjava.addOnloadCallback(javafxEmbed);
hidepreviousElement(count-1);
}



function addElement(cc) {

var ni = document.getElementById('ccc');
var newdiv = document.createElement('div');
var divIdName = 'javafx-app-placeholder'+cc;
newdiv.setAttribute('id',divIdName);
ni.appendChild(newdiv);
}

function hidepreviousElement(cc){
var ni = document.getElementById('javafx-app-placeholder'+cc);
ni.style.display = 'none';
}

</script>

</head><body>
<h2>__</h2>


<a href='#' onclick="launchit();">start JFX</a><br><hr><br>


<br>

<!-- Applet will be inserted here -->
<div id='ccc'><div id='javafx-app-placeholder1'></div></div>

</body></html>

我希望这对某人有帮助并节省他/她的时间..

祝你好运,'。

关于internet-explorer - 无法使用 Internet Explorer 第二次(重新启动)启动 JavaFX Web 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20632160/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com