Here you can find the source of loadImage(String filename)
Parameter | Description |
---|---|
filename | the location of the image |
public static BufferedImage loadImage(String filename)
//package com.java2s; //License from project: Apache License import javax.imageio.ImageIO; import java.io.File; import java.io.IOException; import java.awt.image.BufferedImage; public class Main { /**/*from w ww. j a v a 2 s.c o m*/ * Loads the given file location as a buffered image * Returns null if the image is not found * * @param filename the location of the image * @return specified image or null **/ public static BufferedImage loadImage(String filename) { BufferedImage img = null; try { return ImageIO.read(new File(filename)); } catch (IOException e) { e.printStackTrace(); return null; } } }