0
好吧,所以我創建了一個方法,調整ImageIcon的大小我的問題是我怎樣稱呼它爲了使ImageIcon我想調整大小,在這裏感謝,和方法應該工作,因此任何人尋找一個不調整,你應該能夠使用它的方法:)哪裏/如何調用我的resizeimage方法
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;
}