static Icon reescala(Icon ic, int maxW, int maxH) { if (ic == null) { return null; } if (ic.getIconHeight() == maxH && ic.getIconWidth() == maxW) { return ic; } BufferedImage bi = new BufferedImage(ic.getIconHeight(), ic.getIconWidth(), BufferedImage.TYPE_INT_ARGB); Graphics g = bi.createGraphics(); ic.paintIcon(null, g, 0, 0); g.dispose(); Image bf = bi.getScaledInstance(maxW, maxH, Image.SCALE_SMOOTH); return new ImageIcon(bf); }