scalling image with getScaledInstance() in java
===

Can anyone explain this, there are 3 ways by which I have created Image object but only the last object(k) can be successfully scaled using getscalledinstance().


    public class scalingTest extends JPanel {
        
        public static Image i;
        public static Image j;
        public static Image k;
        scalingTest() throws IOException
        {
            i = Toolkit.getDefaultToolkit().getImage("C:/Users/Prashant/Desktop/2.png");
            j = new ImageIcon("C:/Users/Prashant/Desktop/2.png").getImage();
            k = ImageIO.read(new File("C:/Users/Prashant/Desktop/2.png"));
        }
        public static void main(String s[]) throws IOException
        {
            JFrame jf = new JFrame("Scaling TEST");
            jf.add(new scalingTest());
            jf.setSize(500, 500);
            jf.setVisible(true);
        }
        @Override
        public void paintComponent(Graphics g)
        {
            g.drawImage(i.getScaledInstance(100, 100, Image.SCALE_DEFAULT), 0, 0, this);
            g.drawImage(j.getScaledInstance(100, 100, Image.SCALE_DEFAULT), 100, 100, this);
            g.drawImage(k.getScaledInstance(100, 100, Image.SCALE_DEFAULT), 200, 200, this);
        }
    }

