The init() method is interesting, though, in that we're going to do something slightly different; we're going to use JavaFX to view the image. There's no reason we couldn't use Swing like we are in our other TopComponent, but this gives us a good opportunity to demonstrate both how to integrate JavaFX and Swing, as well as JavaFX and the NetBeans platform.
private JFXPanel fxPanel; private void init() { fxPanel = new JFXPanel(); add(fxPanel, BorderLayout.CENTER); Platform.setImplicitExit(false); Platform.runLater(this::createScene); }
JFXPanel is a Swing component that is used to embed JavaFX into Swing. Our Window's layout is BorderLayout, so we add our JFXPanel to it in the CENTER area, and let ...