Picture piece puzzle game in Java
<p>This is my high school project that I am working on. I cannot find a way to show the image on the frame. This is my first problem. I believed that I will have more questions in the future. Below is my current code.</p>

<p>First part:</p>

<pre><code>import java.awt.GridLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JApplet;

public class GameVer2 extends JApplet implements ActionListener{
    private int sizeOfGame = 16;
    private ImageIcon[] picts = {new ImageIcon("back.png"),
    new ImageIcon("field.png"),new ImageIcon("front.png"),
    new ImageIcon("gym.png"),new ImageIcon("mermaid.png"),
    new ImageIcon("mickey_pirate.png"),new ImageIcon("path.png"),
    new ImageIcon("tweety.png"),new ImageIcon("back.png"),
    new ImageIcon("field.png"),new ImageIcon("front.png"),
    new ImageIcon("gym.png"),new ImageIcon("mermaid.png"),
    new ImageIcon("mickey_pirate.png"),new ImageIcon("path.png"),
    new ImageIcon("tweety.png")};

    private GamePiece[] tiles = new GamePiece[sizeOfGame];
    private int[] tilesReady;
    private int turn = 0;
    private GamePiece[] data = new GamePiece[2];

    public GameVer2(){
        this.setVisible(true);
        this.setLayout(new GridLayout(4,4));
        buildGamePieces();
    }

    public void buildGamePieces(){
        for(int i=0; i&lt;tiles.length; i++){
            tiles[i] = new GamePiece(picts[i],i);
            this.getContentPane().add(tiles[i]);
            tiles[i].addActionListener(this);
            tiles[i].setActionCommand(i+"");
            this.getContentPane().add(tiles[i]);
            tiles[i].getImage();
        }
    }
    @Override
    public void actionPerformed(ActionEvent arg0){
        System.out.println("hello");
    }

    public void init(){
        GameVer2 go = new GameVer2();
    }
}
</code></pre>

<p>Second part:</p>

<pre><code>import javax.swing.ImageIcon;
import javax.swing.JButton;


public class GamePiece extends JButton{

    private ImageIcon image;
    private int id;

    //GamePiece b = new GamePiece("gym.png",1);
    //GamePiece c = new GamePiece("front.png",2);
    // b.match(c);

    public boolean match(GamePiece a){
        return this.getImage().toString().equals(a.getImage().toString());
    }

    public ImageIcon getImage(){
        return image;
    }

    public void setImage(ImageIcon image){
        this.image = image;
    }

    public int getID(){
        return id;
    }

    public void setId(int id){
        this.id = id;
    }

    public GamePiece (ImageIcon pict, int i){
        image = pict;
        id = i;
    }
}
</code></pre>
