在网页中运行 JavaFX 程序,而不是启动新窗口

发布于 2024-07-14 16:46:52 字数 237 浏览 3 评论 0原文

我在阅读中看到了很多 JavaFX 示例,但我看到的每个 JavaFX 应用程序都需要在单独的窗口中启动。 这些应用程序不在网页内运行。

JavaFX 应用程序是否可以在网页中运行,就像我们期望运行 Flash 应用程序(或者就此而言,小程序)一样? 人们不让 JavaFX 应用程序在其网页中运行是否有原因?

是否需要使用特定的 HTML 代码来让 JavaFX 应用程序运行 Flash/applet 样式?

I've seen lots of examples of JavaFX in my reading, but every JavaFX app I've seen need to be launched in a separate window. The apps don't run within a web page.

Can JavaFX applications be run within a web page, just like we would expect a Flash app (or, for that matter, an applet) to run? Is there a reason why people aren't letting JavaFX apps run within their web pages?

Is there a particular bit of HTML code that needs to be used to get a JavaFX app to run Flash/applet-style?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

夜司空 2024-07-21 16:46:52

是的,只需在 NetBeans 中构建一个演示 JavaFX 应用程序即可。 如果他们没有为您提供某种类型的“Hello World”测试应用程序,我会感到惊讶。 然后看一下它创建的 HTML 页面。

如果您在让 JavaFX 应用程序在网页上运行时遇到问题,请查看 此问题。 简而言之,您不能只复制 jar 文件并将相应的 HTML 复制并粘贴到您的网页中。 您需要包含 NetBeans 创建的 JNLP 文件,并且必须编辑 JNLP 文件中的一些 NetBeansy 内容。

Yes, just build a demo JavaFX application in NetBeans. I'd be surprised if they didn't provide you with some type of 'Hello World' test app. Then take a look at the HTML page it creates.

If you run into problems getting your JavaFX app to run on a webpage, take a look at this question. The short story is that you can't just copy jar files and copy and paste the appropriate HTML into your webpage. You need to include the JNLP file NetBeans creates, and you have to edit some of the NetBeansy stuff in the JNLP file.

夜巴黎 2024-07-21 16:46:52

是的,只需使用运行应用程序作为 Java Applet 即可。 NetBeans 将为所有平台(包括 Java Applet)正确部署所有 FX 内容。

Yep, just use run application as Java Applet. NetBeans will deploy all FX stuff correctly for all platforms including Java Applet.

左岸枫 2024-07-21 16:46:52

是的,你可以做到。

查找有关 JNLPAppletLauncher

Yes you can do it.

Look for about JNLPAppletLauncher

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文