Here you can find the source of loadImageFromFile(File f)
public static Image loadImageFromFile(File f)
//package com.java2s; //License from project: Open Source License import javax.imageio.ImageIO; import java.awt.Image; import java.io.File; import java.io.IOException; public class Main { public static Image loadImageFromFile(File f) { try {/*from w ww.ja v a 2 s. co m*/ return ImageIO.read(f); } catch (IOException e) { System.out.println("Couldn't load image " + f.getPath()); e.printStackTrace(); } return null; } }