import java.io.File;
import java.io.FileNotFoundException;

import javafx.scene.image.Image;

public class ImageView extends javafx.application.Application { 

	@Override 
	public void start(javafx.stage.Stage stage) throws Exception { 
	
		javafx.scene.image.Image icon = getTestImage(); 
		stage.getIcons().add(icon); 
		
        javafx.scene.image.Image image = getTestImage(); 
        javafx.scene.image.ImageView imageView = 
            new javafx.scene.image.ImageView(); 
        imageView.setImage(image); 
        javafx.scene.Group group = new javafx.scene.Group(); 
        group.getChildren().add(imageView); 
        javafx.scene.Scene scene = new javafx.scene.Scene(group); 
        stage.setScene(scene); 
	
		stage.setWidth(300); 
		stage.setHeight(300); 
		stage.show(); 
	}
	public Image getTestImage() throws FileNotFoundException {
	    String pathToAnExistingAndValidImageFile = "D:\\Incidents\\JI-9076209\\java-coffee-cup-logo.png";
	    File existingImageFile = new File(pathToAnExistingAndValidImageFile);
	    if (existingImageFile.exists()) {
	        return new Image(pathToAnExistingAndValidImageFile);
	    } else {
	        throw new FileNotFoundException(pathToAnExistingAndValidImageFile);
	    }
	}
	public static void main(String[] args) {
		launch(args);
	}

} 
