Here you can find the source of prepareImage(ImageIcon icon, int x, int y)
private static ImageIcon prepareImage(ImageIcon icon, int x, int y)
//package com.java2s; //License from project: Open Source License import java.awt.Image; import javax.swing.ImageIcon; public class Main { private static ImageIcon prepareImage(ImageIcon icon, int x, int y) { Image img = icon.getImage(); Image newImg = img.getScaledInstance(x, y, java.awt.Image.SCALE_SMOOTH); return new ImageIcon(newImg); }//from w w w. j av a 2 s . c o m }