Here you can find the source of getImageIcon(Image imp, int width, int height)
public static Icon getImageIcon(Image imp, int width, int height)
//package com.java2s; //License from project: Open Source License import java.awt.Image; import javax.swing.Icon; import javax.swing.ImageIcon; public class Main { public static Icon getImageIcon(Image imp, int width, int height) { Image image = imp.getScaledInstance(width, height, Image.SCALE_SMOOTH); Icon icon = new ImageIcon(image); return icon; }/*from w w w . j a va2 s . c o m*/ }