Here you can find the source of scaleIcon(Image iconImage, int size)
public static BufferedImage scaleIcon(Image iconImage, int size)
//package com.java2s; //License from project: Open Source License import java.awt.*; import java.awt.image.BufferedImage; import javax.swing.ImageIcon; public class Main { public static ImageIcon scaleIcon(ImageIcon icon, int size) { return new ImageIcon(scaleIcon(icon.getImage(), size)); }// w w w.j a va 2 s . c o m public static BufferedImage scaleIcon(Image iconImage, int size) { BufferedImage newImage = new BufferedImage(size, size, BufferedImage.TYPE_INT_ARGB); Graphics2D g2 = newImage.createGraphics(); try { g2.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC); g2.drawImage(iconImage, 0, 0, size, size, null); } finally { g2.dispose(); } return newImage; } }