I'm fairly new to using JavaFX and I am looking to add a JPanel into a JavaFX Pane. The code I currently have works, however the panel is very small. I want to be able to resize it so it fits the JavaFX pane.
Code:
// Add swing component to JFX
final SwingNode swingNode = new SwingNode();
createAndSetSwingContent(swingNode);
detailPane.getChildren().add(swingNode);
Create Swing content method:
private void createAndSetSwingContent(final SwingNode swingNode) {
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
//Create the viewing pane.
dataComponentDetailPane = new JEditorPane();
dataComponentDetailPane.setEditable(false);
dataDetailView = new JScrollPane(dataComponentDetailPane);
// Create panel
mainSwingPanel = new JPanel();
mainSwingPanel.add(dataDetailView);
swingNode.setContent(mainSwingPanel);
}
});
}
How do I fit the SwingNode/JPanel to fit the size of the JavaFX pane ?
I'm using FMXL to create the Java FX pane. Thanks in advance !