Adding an image to a scene of the JavaFX application does not require the com.sun.* packages, so the --add-export VM options listed in the Adding HTML section are not needed. But, it does not hurt to have them anyway, so leave the --add-export options in place, if you have added them already.
An image can be included in a scene using the classes javafx.scene.image.Image and javafx.scene.image.ImageView. To demonstrate how to do it, we are going to use the Packt logo packt.png located in the resources folder. Here is the code that does it:
Text txt = new Text("What a beautiful image!");
FileInputStream input =
new FileInputStream("src/main/resources/packt.png");
Image image = new Image(input);
ImageView iv = new ImageView(image);
VBox vb = new VBox(txt, iv);
vb.setSpacing(20);
vb.setAlignment(Pos.CENTER);
vb.setPadding(new Insets(10, 10...