Hi Nitin,

I can not tell you exactly without looking at the gif image. But if you want to 
change the size of animated gifs, you can not use the scaling method that you 
have written. It will only scale the first frame of the image. You can use 
Image.getScaledInstance() instead but it may have performance implications.

If you are using ImageIcon as it is (not the image directly)  and if you want 
the icon to be drawn to the size specified by you, you can actually extend 
ImageIcon class and create your own icon. Include a setSize() method and 
override the paintIcon(), getIconWidth(),getIconHeight() methods of ImageIcon 
to draw the image to the specified size. I have given a small example below:

class MyIcon extends ImageIcon {

    int width, height;

    public MyIcon(String fileName) {
        super(fileName);
    }

    public void paintIcon(Component c, Graphics g, int x, int y) {
        if (getImage() != null) {
            g.drawImage(getImage(), x, y, getIconWidth(), getIconHeight(), c);
        }
    }

    public void setSize(int w, int h) {
        width = w;
        height = h;
    }

    public int getIconWidth() {
        return width;
    }

    public int getIconHeight() {
        return height;
    }
}

Then you can create the icon as follows:
MyIcon icon = new MyIcon(fileName);
icon.setSize(width, height);
jlabel.setIcon(icon);

This will draw the icon to the required size. But remember that the image 
represented by this icon would still have the original size.
Not sure if this is what you are looking for.
[Message sent by forum member 'j2d_lover' (j2d_lover)]

http://forums.java.net/jive/thread.jspa?messageID=139009

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA2D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to