简体   繁体   English

混合JavaFX和Swing

[英]Mixing JavaFX and Swing

i am writing a desktop application and i like to use swing components since javafx doen't provide a tabbedpane component. 我正在编写一个桌面应用程序,我喜欢使用swing组件,因为javafx不提供tabbedpane组件。 I can embed my custom swing component with SwingComponent.wrap(swingComp); 我可以使用SwingComponent.wrap(swingComp)嵌入我的自定义swing组件; So i have a swing tabbedpane which accepts swing components as child items. 所以我有一个摆动tabbedpane接受摇摆组件作为儿童用品。 These child items are swing components too and they have two properties, title and content. 这些子项也是swing组件,它们有两个属性,title和content。 Title is a string but content is a swingcomponent. 标题是一个字符串,但内容是一个swing组件。 How can i embed a javafx container again in those swing tabs? 如何在这些摆动标签中再次嵌入javafx容器? Thanks in advance. 提前致谢。

I suspect that once you go from JavaFX to Swing using the wrap method, you can't return to JavaFX. 我怀疑一旦你使用wrap方法从JavaFX转到Swing,你就无法返回JavaFX。

You probably need to specify a JPanel, then add the JTabbedPane to the JPanel. 您可能需要指定JPanel,然后将JTabbedPane添加到JPanel。 Your content would reference the JPanel. 您的内容将引用JPanel。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM