3
我有,我想在java中来调整,但试图使用传统方法时,它似乎不工作的动画.GIF
图像:调整大小。GIF图像
ImageIcon esclamativoMid = null;
//... search my file...
if(name.equalsIgnoreCase("esclamativo.gif"))
esclamativoMid = new ImageIcon(f.getAbsolutePath());
myEnumMap.put(Resolution.MID, esclamativoMid);
for(Resolution r: Resolution.values()){
if(r != Resolution.MID){
int w = esclamativoMid.getIconWidth()*(r.ordinal()+1)/2;
int h = esclamativoMid.getIconHeight()*(r.ordinal()+1)/2;
BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
Graphics2D g2d = (Graphics2D)bi.createGraphics();
g2d.addRenderingHints(new RenderingHints(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY));
g2d.drawImage(esclamativoMid.getImage(), 0, 0, w, h, null);
myEnumMap.put(r, new ImageIcon(bi));
}
}
当我尝试显示图像使用代码:
new JLabel(myEnumMap.get(currentRes));
我得到.GIF
仅当Resolution.MID
(IE的图像直接从文件加载)。
我试过了,对其他图像看起来不错,但'.GIF'图像是固定的:( – Giudark 2013-02-25 02:37:50