How do I embed a JFrame into a JavaFX 2.0 application?(如何将 JFrame 嵌入到 JavaFX 2.0 应用程序中?)
问题描述
我已经广泛搜索了 stackoverflow 以获取有关此主题的帮助,但我发现的 Q&As 我发现是旧的,并且对于当前版本的 JDK(我目前使用的是 7u51)的答案已经改变.
I have searched stackoverflow extensively for help on this topic, but the Q&As I found are old and the answers have changed for the current version of the JDK (I'm currently using 7u51).
请注意,我从一开始就对 Swing 并不十分精通,但我相信我了解基础知识.(我一直更关注应用程序内部的内容,而不是 GUI).
Note that I was never SUPER proficient in Swing to begin with, but I believe I understand the fundamentals. (I've always been more focused on the meat inside an app, not the GUI).
我正在尝试使用第三方库.第三方库要求其组件使用 JFrame.
I'm trying to work with a third party library. The third party library requires that it's components use JFrame.
因此,我试图了解如何将 JFrame 嵌入到我的 JavaFX 应用程序中.有一个关于使用 javafx.ext.swing 做某事的旧答案,但它不再包含在 JavaFX 中.
Therefore, I'm trying to see how I would embed a JFrame into my JavaFX application. There was an old answer about doing something with javafx.ext.swing, but that's no longer included in JavaFX.
帮助?
===========
==========
我还应该补充一点:我认为目前是测试版的 Java 8 将支持我需要的内容:http://docs.oracle.com/javafx/8/embed_swing/jfxpub-embed_swing.htm ,但我需要看看是否有办法在不依赖测试版产品的情况下做到这一点.
I should also add: I think Java 8, which is currently beta, will support what I need based on this: http://docs.oracle.com/javafx/8/embed_swing/jfxpub-embed_swing.htm , but I need to see if there is a way to do this without relying on a beta product.
推荐答案
- 创建一个
SwingNode
s - 创建一个
JComponent
c - 调用
s.setContent(c)
这篇关于如何将 JFrame 嵌入到 JavaFX 2.0 应用程序中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将 JFrame 嵌入到 JavaFX 2.0 应用程序中?
基础教程推荐
- Java 中保存最后 N 个元素的大小受限队列 2022-01-01
- 如何使用 Stream 在集合中拆分奇数和偶数以及两者的总和 2022-01-01
- Spring Boot Freemarker从2.2.0升级失败 2022-01-01
- 由于对所需库 rt.jar 的限制,对类的访问限制? 2022-01-01
- 如何使用 Eclipse 检查调试符号状态? 2022-01-01
- 如何对 HashSet 进行排序? 2022-01-01
- 如何强制对超级方法进行多态调用? 2022-01-01
- 如何在不安装整个 WTP 包的情况下将 Tomcat 8 添加到 Eclipse Kepler 2022-01-01
- 首次使用 Hadoop,MapReduce Job 不运行 Reduce Phase 2022-01-01
- 在螺旋中写一个字符串 2022-01-01