Here you can find the source of createImageIcon(URL url, String description, Integer w, Integer h)
public static ImageIcon createImageIcon(URL url, String description, Integer w, Integer h)
//package com.java2s; //License from project: Open Source License import java.net.URL; import javax.swing.ImageIcon; public class Main { public static ImageIcon createImageIcon(URL url, Integer w, Integer h) { return createImageIcon(url, null, w, h); }/*from ww w. jav a2 s. c o m*/ public static ImageIcon createImageIcon(URL url, String description, Integer w, Integer h) { ImageIcon imageIcon = new ImageIcon(url, description); if (w != null && h != null) { imageIcon = new ImageIcon(imageIcon.getImage().getScaledInstance(w, h, java.awt.Image.SCALE_SMOOTH)); } return imageIcon; } }