Here you can find the source of SetStandardSizeForImage(ImageIcon icon)
public static Icon SetStandardSizeForImage(ImageIcon icon)
//package com.java2s; //License from project: Open Source License import java.awt.Graphics; import java.awt.Image; import java.awt.image.BufferedImage; import javax.swing.Icon; import javax.swing.ImageIcon; public class Main { public static Icon SetStandardSizeForImage(ImageIcon icon) { Image img = icon.getImage(); BufferedImage bi = new BufferedImage(50, 50, BufferedImage.TYPE_INT_ARGB); Graphics g = bi.createGraphics(); g.drawImage(img, 0, 0, 50, 50, null); Icon newIcon = new ImageIcon(bi); return newIcon; }/*from w ww. ja va 2s .c om*/ }