Java BufferedImage Load loadImage(Object whoOrders, String name)

Here you can find the source of loadImage(Object whoOrders, String name)

Description

load Image

License

Apache License

Declaration

public static BufferedImage loadImage(Object whoOrders, String name) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.IOException;

public class Main {
    public static BufferedImage loadImage(Object whoOrders, String name) {
        BufferedImage image = null;
        try {//  w  w  w .j  a v  a  2s  . c o  m
            image = ImageIO.read(whoOrders.getClass().getResource("/" + name));
        } catch (IOException e) {
            e.printStackTrace();
        }
        return image;
    }
}

Related

  1. loadImage(final String imagePathname, final Class relatedClass)
  2. loadImage(final String path)
  3. loadImage(final URL urlToImage)
  4. loadImage(Image image)
  5. loadImage(InputStream inputStream)
  6. loadImage(String classRelativeFile)
  7. loadImage(String filename)
  8. loadImage(String fileName)
  9. loadImage(String fileName, Component c)