6. Embed Swing Components
Any Swing component can be embedded in a JavaFX scene graph using the SwingComponent wrap() function. This conveniently allows you to directly leverage those Swing components which you've already configured, customized, and hooked to your application data; all that Java code can remain happily unmodified. Once you've created the structure of your scene's layout, you can pull your Swing components into the appropriate locations. Here's a simple example:
def swingTable = new JTable();
Stage {
scene: Scene {
content: VBox {
content: [
SwingComponent.wrap(swingTable),
// other FX nodes
]
}
}
}