Java ImageIcon Create createImageIcon(String imgFile)

Here you can find the source of createImageIcon(String imgFile)

Description

create image icon

License

Open Source License

Declaration

public static ImageIcon createImageIcon(String imgFile) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.net.*;

import javax.swing.*;

public class Main {
    /**//from w  w w  . j a v  a  2s. c  o m
     * create image icon
     */
    public static ImageIcon createImageIcon(String imgFile) {
        URL imgUrl = ClassLoader.getSystemClassLoader()
                .getResource(imgFile);
        if (imgUrl == null) {
            return null;
        }

        return new ImageIcon(imgUrl);
    }
}

Related

  1. createImageIcon(File f, String description)
  2. createImageIcon(final Icon icon)
  3. createImageIcon(final String src)
  4. createImageIcon(java.net.URL imgURL)
  5. createImageIcon(String iconFile)
  6. createImageIcon(String path)
  7. createImageIcon(String path)
  8. createImageIcon(String path)
  9. createImageIcon(String path)