We can load and display an image in JavaFX using ImageView.
import javafx.application.Application; import javafx.geometry.Pos; import javafx.scene.Scene; import javafx.scene.image.Image; import javafx.scene.image.ImageView; import javafx.scene.layout.FlowPane; import javafx.stage.Stage; public class Main extends Application { public static void main(String[] args) { launch(args);/*from www . j a v a2 s. c om*/ } public void start(Stage myStage) { myStage.setTitle("Display an Image"); // Use a FlowPane for the root node. FlowPane rootNode = new FlowPane(); // Use center alignment. rootNode.setAlignment(Pos.CENTER); Scene myScene = new Scene(rootNode, 300, 200); myStage.setScene(myScene); // Create an image. Image hourglass = new Image("your.png"); // Create an image view that uses the image. ImageView aImage = new ImageView(hourglass); // Add the image to the scene graph. rootNode.getChildren().add(aImage); myStage.show(); } }