简体   繁体   English

将swing组件添加到javafx选项卡

[英]add swing component into javafx tab

I have a JavaFX and a separate swing project. 我有一个JavaFX和一个单独的swing项目。 Now i need to add that jframe into my JavaFX project inside a Tab. 现在,我需要将该jframe添加到Tab内的JavaFX项目中。 By doing some research i go to know that i can not add jframe directly so i need SwingNode. 通过做一些研究,我知道我不能直接添加jframe,所以我需要SwingNode。 I am able to add jframe without any error but the frame gui get very disturb. 我能够添加jframe而不会出现任何错误,但是frame gui会引起很大的困扰。 jfram is not visible at first time and when i hover my mouse on over it, it become visible only for that area, except that the hint popup also not visible. jfram第一次不可见,当我将鼠标悬停在其上时,它仅在该区域可见,除了提示弹出窗口也不可见。 Below is the code. 下面是代码。 Please help me with adding swing component inside javafx successfully. 请帮助我在javafx中成功添加swing组件。

  SyntaxTester ob = new SyntaxTester();
        SwingNode swingnode = new SwingNode();
        swingnode.setContent(ob.getEditor()); //getEditor returns jEditorPane
        tab.setContent(swingnode);

JFrame comes with its own decorations and they might be causing the issues. JFrame带有自己的装饰,它们可能会引起问题。 Instead of adding JFrame - add JFrame#getContentPane() . 代替添加JFrame-添加JFrame#getContentPane()

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

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