Source Code : Returns an image resource.
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Returns an image resource.
import javax.imageio.ImageIO;
import java.awt.*;
import java.awt.image.BufferedImage;
import java.awt.image.FilteredImageSource;
import java.awt.image.RGBImageFilter;
import java.io.IOException;
import java.net.URL;
public class ImageUtil {
/**
* Returns an image resource.
*
* @param filename the filename of the image to load
* @return the loaded image
*/
public static Image getImage(String filename) {
URL url = ImageUtil.class.getResource(filename);
if (url == null) {
return null;
}
try {
final BufferedImage result = ImageIO.read(url);
if (result == null) {
final String message = "Could not load image: " + filename;
throw new Error();
}
return result;
} catch (IOException e) {
return null;
}
}
}
Thank with us