public Chess1(String title){


    super(title);
    Dimension boardSize = new Dimension(800, 800);

    layeredPane = new JLayeredPane();
    getContentPane().add(layeredPane);
    layeredPane.setPreferredSize(boardSize);
    layeredPane.addMouseListener(this);
    layeredPane.addMouseMotionListener(this);

    chessBoard = new JPanel();
    layeredPane.add(chessBoard, JLayeredPane.DEFAULT_LAYER);
    chessBoard.setLayout( new GridLayout(8, 8) );
    chessBoard.setPreferredSize( boardSize );
    chessBoard.setBounds(0, 0, boardSize.width, boardSize.height);
     for (int i = 0; i < 64; i++) {
     JPanel square = new JPanel( new BorderLayout() );
     chessBoard.add( square );
      int row = (i / 8) % 2;
      if (row == 0)
     square.setBackground( i % 2 == 0 ? Color.black : Color.white );
     else
     square.setBackground( i % 2 == 0 ? Color.white : Color.black );
     }
    JLabel piece = new JLabel( new ImageIcon("3.png") );
    JPanel panel = (JPanel)chessBoard.getComponent(0);
    panel.add(piece);
    piece = new JLabel(new ImageIcon("5.png"));
    panel = (JPanel)chessBoard.getComponent(1);
    panel.add(piece);
    piece = new JLabel(new ImageIcon("4.png"));
        panel = (JPanel)chessBoard.getComponent(2);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("2.png"));
        panel = (JPanel)chessBoard.getComponent(3);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("1.jpg"));
        panel = (JPanel)chessBoard.getComponent(4);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("4.png"));
        panel = (JPanel)chessBoard.getComponent(5);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("5.png"));
        panel = (JPanel)chessBoard.getComponent(6);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("3.png"));
        panel = (JPanel)chessBoard.getComponent(7);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("6.png"));
        panel = (JPanel)chessBoard.getComponent(8);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("6.png"));
        panel = (JPanel)chessBoard.getComponent(9);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("6.png"));
        panel = (JPanel)chessBoard.getComponent(10);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("6.png"));
        panel = (JPanel)chessBoard.getComponent(11);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("6.png"));
        panel = (JPanel)chessBoard.getComponent(12);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("6.png"));
        panel = (JPanel)chessBoard.getComponent(13);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("6.png"));
        panel = (JPanel)chessBoard.getComponent(14);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("6.png"));
        panel = (JPanel)chessBoard.getComponent(15);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("12.png"));
        panel = (JPanel)chessBoard.getComponent(48);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("12.png"));
        panel = (JPanel)chessBoard.getComponent(49);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("12.png"));
        panel = (JPanel)chessBoard.getComponent(50);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("12.png"));
        panel = (JPanel)chessBoard.getComponent(51);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("12.png"));
        panel = (JPanel)chessBoard.getComponent(52);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("12.png"));
        panel = (JPanel)chessBoard.getComponent(53);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("12.png"));
        panel = (JPanel)chessBoard.getComponent(54);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("12.png"));
        panel = (JPanel)chessBoard.getComponent(55);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("9.png"));
        panel = (JPanel)chessBoard.getComponent(56);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("11.png"));
        panel = (JPanel)chessBoard.getComponent(57);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("10.png"));
        panel = (JPanel)chessBoard.getComponent(58);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("8.png"));
        panel = (JPanel)chessBoard.getComponent(59);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("7.png"));
        panel = (JPanel)chessBoard.getComponent(60);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("10.png"));
        panel = (JPanel)chessBoard.getComponent(61);
        panel.add(piece);        
        piece = new JLabel(new ImageIcon("11.png"));
        panel = (JPanel)chessBoard.getComponent(62);
        panel.add(piece);
        piece = new JLabel(new ImageIcon("9.png"));
        panel = (JPanel)chessBoard.getComponent(63);
        panel.add(piece);
        
               
      board = new Board();
      new King(board, false, new Position(4, 0));
      new King(board, true, new Position(4, 7));
      for (int i = 0; i<8; i++) {
        new Pawn(board, false, new Position(i, 1));
      }
      for (int i = 0; i<8; i++) {
        new Pawn(board, true, new Position(i, 6));
       }
       new Rook(board, false, new Position(0,0));
       new Rook(board, false, new Position(7,0));
       new Rook(board, true, new Position(0,7));
       new Rook(board, true, new Position(7,7));

       new Knight(board, false, new Position(1,0));
       new Knight(board, false, new Position(6,0));
       new Knight(board, true, new Position(1,7));
       new Knight(board, true, new Position(6,7));

       new Bishop(board, false, new Position(2,0));
       new Bishop(board, false, new Position(5,0));
       new Bishop(board, true, new Position(2,7));
       new Bishop(board, true, new Position(5,7));

       new Queen(board, false, new Position(3, 0));
       new Queen(board, true, new Position(3, 7));

    }