Java ImageIcon Create createImageIcon(String path, int width, int height)

Here you can find the source of createImageIcon(String path, int width, int height)

Description

create Image Icon

License

Creative Commons License

Declaration

public static ImageIcon createImageIcon(String path, int width,
            int height) 

Method Source Code

//package com.java2s;
//License from project: Creative Commons License 

import java.awt.Image;

import java.net.URL;
import javax.swing.ImageIcon;

public class Main {
    public static ImageIcon createImageIcon(String path, int width,
            int height) {
        URL imgURL = ClassLoader.getSystemResource("img/" + path);
        return new ImageIcon(new ImageIcon(imgURL).getImage()
                .getScaledInstance(width, height, Image.SCALE_DEFAULT));
    }//  w  w w.  j  av a 2 s  .  co m
}

Related

  1. createImageIcon(String path)
  2. createImageIcon(String path)
  3. createImageIcon(String path)
  4. createImageIcon(String path, Class resourceClass)
  5. createImageIcon(String path, Class c)
  6. createImageIcon(String path, String description)
  7. createImageIcon(String path, String description)
  8. createImageIcon(String resourcePath)
  9. createImageIcon(URL url)