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