I have embedded the JFXPanel in JavaFx into the Content of the ToolWindow. When the toolwindow is minimized and then opened, the JFXPanel disappears. The Jpanel of Swing is fine.
this is my code:
public class ToolWindowFactoryDemo implements ToolWindowFactory {
@Override
public void createToolWindowContent(@NotNull Project project, @NotNull ToolWindow toolWindow) {
System.out.println("createToolWindowContent enter.");
ContentFactory contentFactory = ContentFactory.SERVICE.getInstance();
Content labelContent = new ContentImpl(buildComponent3(),"Cpu&Memory", false);
toolWindow.getContentManager().addContent(labelContent);
labelContent.fireAlert();
}
private JComponent buildComponent2() { // swing test is ok
JPanel jPanel = new JPanel();
jPanel.add(new Button("button"));
return jPanel;
}
private JComponent buildComponent3() { // jfxPanel has this problem
JFXPanel jfxPanel = new JFXPanel();
System.out.println("buildComponent3 enter.");
jfxPanel.setScene(new Scene(new javafx.scene.control.Button("button")));
return jfxPanel;
}
I have embedded the JFXPanel in JavaFx into the Content of the ToolWindow. When the toolwindow is minimized and then opened, the JFXPanel disappears. The Jpanel of Swing is fine.
this is my code: