I have a simple Java script here and it does not work. I have an array with images from URL. I want it to change when I click on the button.

```
import java.awt.BorderLayout;
import java.awt.Image;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.net.URL;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class ChangeURLImages 
{   
public static void main( String[] args )
{
    final String[] array = new String[]{"http://s3.amazonaws.com/37assets/svn/765-default-avatar.png", "http://indianraga.in/assets/default-bf4b832252a9579cf3408c88b2601a0e.jpg"};
    BufferedImage image = null;
    try {
        URL url = new URL(array[0]);
        image = ImageIO.read(url);
    } catch (IOException e) {
        e.printStackTrace();
    }

    JFrame f = new JFrame();
    f.setVisible(true);
    f.setSize(500, 600);
    f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    final JLabel label = new JLabel(new ImageIcon(image));
    JButton change = new JButton("Change");

    JPanel p = new JPanel(new BorderLayout());

    p.add(change, BorderLayout.NORTH);
    p.add(label, BorderLayout.CENTER);

    f.add(p);

    change.addActionListener (new ActionListener () {
        public void actionPerformed(ActionEvent e) {
            URL url;
            try {
                url = new URL(array[1]);
                BufferedImage image = ImageIO.read(url);
                JLabel label = new JLabel(new ImageIcon(image));
            } catch (IOException e1) {
                // TODO Auto-generated catch block
                e1.printStackTrace();
            }

        }
    });

}
}

```

I tried and tried. Different ways, but I was not able to do this.

Can someone help me with this?
Thank you.