【发布时间】:2014-03-30 06:05:35
【问题描述】:
好的,所以我创建了一个调整 ImageIcon 大小的方法,我的问题是如何/在哪里调用它以使 ImageIcon 我想调整到该大小,谢谢,该方法应该可以工作,所以任何人都在寻找一个可以调整大小的方法,你应该可以使用它:)
public static void resizeIcon(ImageIcon icon, int Width, int Height){
Image geticon = icon.getImage();
BufferedImage bi = new BufferedImage(geticon.getWidth(null), geticon.getHeight(null), BufferedImage.TYPE_INT_RGB);
Graphics g = bi.createGraphics();
g.drawImage(geticon, 0, 0, Width, Height, null);
ImageIcon resizedicon = new ImageIcon(bi);
icon = resizedicon;
}
【问题讨论】:
标签: java resize bufferedimage graphics2d imageicon