如何将 JFrame 嵌入到 JavaFX 2.0 应用程序中?

How do I embed a JFrame into a JavaFX 2.0 application?(如何将 JFrame 嵌入到 JavaFX 2.0 应用程序中?)

本文介绍了如何将 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.

推荐答案

  1. 创建一个SwingNode s
  2. 创建一个JComponent c
  3. 调用s.setContent(c)

这篇关于如何将 JFrame 嵌入到 JavaFX 2.0 应用程序中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:如何将 JFrame 嵌入到 JavaFX 2.0 应用程序中?

基础教程推荐