DQogICAgPG9mZmxpbmUtYWxsb3dlZC8

DQogICAgPG9mZmxpbmUtYWxsb3dlZC8

本文介绍了如何在现有网页中插入在javafx fxml项目中生成的html代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个名为Login的javafx fxml应用程序项目。它工作正常,我成功地让该项目在浏览器(Firefox)中运行。当在Netbeans IDE 8.1中为上述项目创建项目时,它的html文件是以Login.html名称自动创建的。



Login.html



< html>< head> < SCRIPT src =./ web-files / dtjava.js>< / SCRIPT>< script>功能launchApplication(jnlpfile){dtjava.launch({URL:Login.jnlp,jnlp_content:PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iTG9naW4uam5scCI + DQogIDxpbmZvcm1hdGlvbj4NCiAgICA8dGl0bGU + TG9naW48L3RpdGxlPg0KICAgIDx2ZW5kb3I + c2FjaGk8L3ZlbmRvcj4NCiAgICA8ZGVzY3JpcHRpb24 + bnVsbDwvZGVzY3JpcHRpb24 + DQogICAgPG9mZmxpbmUtYWxsb3dlZC8 + DQogIDwvaW5mb3JtYXRpb24 + DQogIDxyZXNvdXJjZXM + DQogICAgPGoyc2UgdmVyc2lvbj0iMS42KyIgaHJlZj0iaHR0cDovL2phdmEuc3VuLmNvbS9wcm9kdWN0cy9hdXRvZGwvajJzZSIvPg0KICAgIDxqYXIgaHJlZj0iTG9naW4uamFyIiBzaXplPSIxNjA3OCIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGRlcmJ5LmphciIgc2l6ZT0iMjc2NzQ1NSIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGRlcmJ5TG9jYWxlX2NzLmphciIgc2l6ZT0iOTQ0MDMiIGRvd25sb2FkPSJlYWdl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NCg =='},{javafx:'8.0+'},{});返回false; }< /脚本><脚本>功能javafxEmbedlogin(){dtjava.embed({ID: '登录',网址: 'Login.jnlp',占位符: 'JavaFX的APP-占位符',宽度: '800',高度: '600',jnlp_content:PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iTG9naW4uam5scCI + DQogIDxpbmZvcm1hdGlvbj4NCiAgICA8dGl0bGU + TG9naW48L3RpdGxlPg0KICAgIDx2ZW5kb3I + c2FjaGk8L3ZlbmRvcj4NCiAgICA8ZGVzY3JpcHRpb24 + bnVsbDwvZGVzY3JpcHRpb24 + DQogICAgPG9mZmxpbmUtYWxsb3dlZC8 + DQogIDwvaW5mb3JtYXRpb24 + DQogIDxyZXNvdXJjZXM + DQogICAgPGoyc2UgdmVyc2lvbj0iMS42KyIgaHJlZj0iaHR0cDovL2phdmEuc3VuLmNvbS9wcm9kdWN0cy9hdXRvZGwvajJzZSIvPg0KICAgIDxqYXIgaHJlZj0iTG9naW4uamFyIiBzaXplPSIxNjA3OCIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGRlcmJ5LmphciIgc2l6ZT0iMjc2NzQ1NSIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGRlcmJ5TG9jYWxlX2NzLmphciIgc2l6ZT0iOTQ0MDMiIGR vd25sb2FkPSJlYWdlciIgLz4NCiAgICA8amFyIGhyZWY9ImxpYlxkZXJieUxvY2FsZV9kZV9ERS5qYXIiIHNpemU9IjEwNjUyOCIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGRlcmJ5TG9jYWxlX2VzLmphciIgc2l6ZT0iMTAwNjQzIiBkb3dubG9hZD0iZWFnZXIiIC8 + DQogICAgPGphci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VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGRlcmJ5bmV0LmphciIgc2l6ZT0iMjQ5ODc0IiBkb3dubG9hZD0iZWFnZXIiIC8 + DQogICAgPGphciBocmVmPSJsaWJcZGVyYnlydW4uamFyIiBzaXplPSI4MTgxIiBkb3dubG9hZD0iZWFnZXIiIC8 + DQogICAgPGphciBocmVmPSJsaWJcZGVyYnl0b29scy5qYXIiIHNpemU9IjIxMjk5MiIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGpmb2VuaXguamFyIiBzaXplPSIyMjE5Njg3IiBkb3dubG9hZD0iZWFnZXIiIC8 + DQogIDwvcmVzb3VyY2VzPg0KPHNlY3VyaXR5Pg0KICA8YWxsLXBlcm1pc3Npb25zLz4NCjwvc2VjdXJpdHk + DQogIDxhcHBsZXQtZGVzYyAgd2lkdGg9IjgwMCIgaGVpZ2h0PSI2MDAiIG1haW4tY2xhc3M9ImNvbS5qYXZhZngubWFpbi5Ob0phdmFGWEZhbGxiYWNrIiAgbmFtZT0iTG9naW4iID4NCiAgICA8cGFyYW0gbmFtZT0icmVxdWlyZWRGWFZlcnNpb24iIHZhbHVlPSI4LjArIi8 + DQogIDwvYXBwbGV0LWRlc2M + DQogIDxqZng6amF2YWZ4LWRlc2MgIHdpZHRoPSI4MDAiIGhlaWdodD0iNjAwIiBtYWluLWNsYXNzPSJsb2dpbi5Mb2dpbiIgIG5hbWU9IkxvZ2luIiAvPg0KICA8dXBkYXRlIGNoZWNrPSJhbHdheXMiLz4NCjwvam5scD4NCg ==},{JavaFX的:‘8.0+’},{}); }<! - 加载页面后将FX应用程序嵌入网页 - > < b>< / h2>< b>< < b取代; Webstart的:其中/ B个< a href ='Login.jnlp'onclick =return launchApplication('Login.jnlp');>点击以启动此应用程序为webstart< / a>< br>< hr>< br> <! - 小程序将插入此处 - > < div id ='javafx-app-placeholder'>< / div>< / body>< / html>



我很努力地将上面的html代码插入到另一个html代码中(从下载的网站模板中),但是失败了。我不知道我做错了什么。请帮助我。

解决方案

我自己找到答案。将NetBeans生成的javafx fxml项目html文件与现成的模板集成起来非常简单。
假设您希望您的javafx fxml项目的html文件与下面给出的html文件集成:

 < HTML>< HEAD><标题> sachin vashistha< / title>< h2>我是sachin vashistha< / h2>< / head>< body>< h2>我在身体中< / h2> < / body>< / html>  

.html文件(有问题)。在这个名为launchApplication()的函数中用于web启动。如果您想将代码嵌入到现成的html文件中,那么我们需要Login.html中的以下两件事:
1)具有函数javafxEmbedlogin()
的脚本部分2)Login.html的正文部分


以下是整合的现成html文件:

 < HTML>< HEAD><标题> sachin vashistha< / title>< h2>我是sachin vashistha< / h2> < SCRIPT src =./ web-files / dtjava.js>< / SCRIPT>< script>功能javafxEmbedlogin(){dtjava.embed({ID: '登录',网址: 'Login.jnlp',占位符: 'JavaFX的APP-占位符',宽度: '400',高度: '600',jnlp_content:PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iTG9naW4uam5scCI + DQogIDxpbmZvcm1hdGlvbj4NCiAgICA8dGl0bGU + TG9naW48L3RpdGxlPg0KICAgIDx2ZW5kb3I + c2FjaGk8L3ZlbmRvcj4NCiAgICA8ZGVzY3JpcHRpb24 + bnVsbDwvZGVzY3JpcHRpb24 + DQogICAgPG9mZmxpbmUtYWxsb3dlZC8 + DQogIDwvaW5mb3JtYXRpb24 + DQogIDxyZXNvdXJjZXM + DQogICAgPGoyc2UgdmVyc2lvbj0iMS42KyIgaHJlZj0iaHR0cDovL2phdmEuc3VuLmNvbS9wcm9kdWN0cy9hdXRvZGwvajJzZSIvPg0KICAgIDxqYXIgaHJlZj0iTG9naW4uamFyIiBzaXplPSIxNjI2MCIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGRlcmJ5Lmphci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Rlc2MgIHdpZHRoPSI0MDAiIGhlaWdodD0iNjAwIiBtYWluLWNsYXNzPSJsb2dpbi5Mb2dpbiIgIG5hbWU9IkxvZ2luIiAvPg0KICA8dXBkYXRlIGNoZWNrPSJhbHdheXMiLz4NCjwvam5scD4NCg ==},{JavaFX的:‘8.0+’},{}); }<! - 加载页面后将FX应用程序嵌入网页 - > dtjava.addOnloadCallback(javafxEmbedlogin);< /脚本>< /头><身体GT;< b取代; Webstart的:其中/ B个< a href ='Login.jnlp'onclick =return launchApplication('Login.jnlp');>点击以启动此应用程序为webstart< / a>< br>< hr>< br> <! - 小程序将插入此处 - > < div id ='javafx-app-placeholder'>< / div>< / body>< / html> 


I created a javafx fxml application project named "Login".It is working fine and I successfully made the project to run in browser (Firefox). while creating the project in Netbeans IDE 8.1 for the above project, it's html file was automatically created under the name "Login.html".

Login.html

<html><head>
  <SCRIPT src="./web-files/dtjava.js"></SCRIPT>
<script>
    function launchApplication(jnlpfile) {
        dtjava.launch(            {
                url : 'Login.jnlp',
                jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iTG9naW4uam5scCI+DQogIDxpbmZvcm1hdGlvbj4NCiAgICA8dGl0bGU+TG9naW48L3RpdGxlPg0KICAgIDx2ZW5kb3I+c2FjaGk8L3ZlbmRvcj4NCiAgICA8ZGVzY3JpcHRpb24+bnVsbDwvZGVzY3JpcHRpb24+DQogICAgPG9mZmxpbmUtYWxsb3dlZC8+DQogIDwvaW5mb3JtYXRpb24+DQogIDxyZXNvdXJjZXM+DQogICAgPGoyc2UgdmVyc2lvbj0iMS42KyIgaHJlZj0iaHR0cDovL2phdmEuc3VuLmNvbS9wcm9kdWN0cy9hdXRvZGwvajJzZSIvPg0KICAgIDxqYXIgaHJlZj0iTG9naW4uamFyIiBzaXplPSIxNjA3OC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HVlPSI4LjArIi8+DQogIDwvYXBwbGV0LWRlc2M+DQogIDxqZng6amF2YWZ4LWRlc2MgIHdpZHRoPSI4MDAiIGhlaWdodD0iNjAwIiBtYWluLWNsYXNzPSJsb2dpbi5Mb2dpbiIgIG5hbWU9IkxvZ2luIiAvPg0KICA8dXBkYXRlIGNoZWNrPSJhbHdheXMiLz4NCjwvam5scD4NCg=='
            },
            {
                javafx : '8.0+'
            },
            {}
        );
        return false;
    }
</script>

<script>
    function javafxEmbedlogin() {
        dtjava.embed(
            {
                id : 'login',
                url : 'Login.jnlp',
                placeholder : 'javafx-app-placeholder',
                width : '800',
                height : '600',
                jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iTG9naW4uam5scCI+DQogIDxpbmZvcm1hdGlvbj4NCiAgICA8dGl0bGU+TG9naW48L3RpdGxlPg0KICAgIDx2ZW5kb3I+c2FjaGk8L3ZlbmRvcj4NCiAgICA8ZGVzY3JpcHRpb24+bnVsbDwvZGVzY3JpcHRpb24+DQogICAgPG9mZmxpbmUtYWxsb3dlZC8+DQogIDwvaW5mb3JtYXRpb24+DQogIDxyZXNvdXJjZXM+DQogICAgPGoyc2UgdmVyc2lvbj0iMS42KyIgaHJlZj0iaHR0cDovL2phdmEuc3VuLmNvbS9wcm9kdWN0cy9hdXRvZGwvajJzZSIvPg0KICAgIDxqYXIgaHJlZj0iTG9naW4uamFyIiBzaXplPSIxNjA3OCIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGRlcmJ5LmphciIgc2l6ZT0iMjc2NzQ1NSIgZG93bmxvYWQ9ImVhZ2VyIiAvPg0KICAgIDxqYXIgaHJlZj0ibGliXGRlcmJ5TG9jYWxlX2NzLmphciIgc2l6ZT0iOTQ0MDMiIGRvd25sb2F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4NCg=='
            },
            {
                javafx : '8.0+'
            },
            {}
        );
    }
    <!-- Embed FX application into web page once page is loaded -->
    dtjava.addOnloadCallback(javafxEmbedlogin);
</script>

</head><body>
<h2>Test page for <b>Login</b></h2>
  <b>Webstart:</b> <a href='Login.jnlp' onclick="return launchApplication('Login.jnlp');">click to launch this app as webstart</a><br><hr><br>

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

I tried very hard to insert the above html code in another html code (from a downloaded website template)but failed. I don't know what i am doing wrong. Please help me.

解决方案

I found out the answer myself. It is very easy to integrate netbeans generated html file for javafx fxml project with a ready made template.Suppose you want your javafx fxml project's html file to integrate with the html file given below:

<html>
<head>
<title> sachin vashistha</title>
<h2> i am sachin vashistha</h2>
</head>
<body>
<h2>i am in body</h2>
</body>
</html>

Now take Login.html file (given in question). In this function named "launchApplication()" is used for web start. If you want to embed your code in ready made html file then we need these two things from Login.html :1) part of the script having function javafxEmbedlogin()2) body part of Login.html

Here is the integrated ready made html file:

<html>
<head>
<title> sachin vashistha</title>
<h2> i am sachin vashistha</h2>
  <SCRIPT src="./web-files/dtjava.js"></SCRIPT>
<script>
    function javafxEmbedlogin() {
        dtjava.embed(
            {
                id : 'login',
                url : 'Login.jnlp',
                placeholder : 'javafx-app-placeholder',
                width : '400',
                height : '600',
                jnlp_content : 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz4NCjxqbmxwIHNwZWM9IjEuMCIgeG1sbnM6amZ4PSJodHRwOi8vamF2YWZ4LmNvbSIgaHJlZj0iTG9naW4uam5scCI+DQogIDxpbmZvcm1hdGlvbj4NCiAgICA8dGl0bGU+TG9naW48L3RpdGxlPg0KICAgIDx2ZW5kb3I+c2FjaGk8L3ZlbmRvcj4NCiAgICA8ZGVzY3JpcHRpb24+bnVsbDwvZGVzY3JpcHRpb24+DQogICAgPG9mZmxpbmUtYWxsb3dlZC8+DQogIDwvaW5mb3JtYXRpb24+DQogIDxyZXNv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wMCIgaGVpZ2h0PSI2MDAiIG1haW4tY2xhc3M9ImNvbS5qYXZhZngubWFpbi5Ob0phdmFGWEZhbGxiYWNrIiAgbmFtZT0iTG9naW4iID4NCiAgICA8cGFyYW0gbmFtZT0icmVxdWlyZWRGWFZlcnNpb24iIHZhbHVlPSI4LjArIi8+DQogIDwvYXBwbGV0LWRlc2M+DQogIDxqZng6amF2YWZ4LWRlc2MgIHdpZHRoPSI0MDAiIGhlaWdodD0iNjAwIiBtYWluLWNsYXNzPSJsb2dpbi5Mb2dpbiIgIG5hbWU9IkxvZ2luIiAvPg0KICA8dXBkYXRlIGNoZWNrPSJhbHdheXMiLz4NCjwvam5scD4NCg=='
            },
            {
                javafx : '8.0+'
            },
            {}
        );
    }
    <!-- Embed FX application into web page once page is loaded -->
    dtjava.addOnloadCallback(javafxEmbedlogin);
</script>
</head>
<body>
<b>Webstart:</b> <a href='Login.jnlp' onclick="return launchApplication('Login.jnlp');">click to launch this app as webstart</a><br><hr><br>

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

这篇关于如何在现有网页中插入在javafx fxml项目中生成的html代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 18:08