public ChessBoard(final JLabel status, final JFrame frame, final JPanel control_panel, int clockTime){
		// creates border around the court area, JComponent method
		setBorder(BorderFactory.createLineBorder(Color.BLACK));
        reset();
        /*final JPanel pieces_panel = new JPanel();
        frame.add(pieces_panel, BorderLayout.SOUTH);*/
        /*piecesStatus = new JLabel("Number WHITE captured: 0 Number BLACK captured: 0");
        control_panel.add(piecesStatus);*/
        
        final JButton autoFlipB = new JButton("Autoflip");
        autoFlipB.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                	if(autoFlipB.getText().equals("X Autoflip")) {
                		autoFlipB.setText("Autoflip");
                		autoFlip = false;
                	} else {
                		autoFlipB.setText("X Autoflip");
                		autoFlip = true;
                	}
                }
            });
        control_panel.add(autoFlipB);
        
        final JButton flip = new JButton("Flip board");
        flip.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                	/*GameObj[][] board = copy(BOARD);
                	for(int i = 0; i < 8; i++) {
                		for(int j = 0; j < 8; j++) {
                			BOARD[i][-1 * j + 7] = board[i][j];
                		}
                	}*/
                	if(flipped) {
                		flipped = false;
                	} else {
                		flipped = true;
                	}
                    repaint();
                }
            });
        control_panel.add(flip);
        
        final JButton resign = new JButton("Resign");
        resign.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                	final JFrame confirmFrame = new JFrame("Confirm resignation");
                	confirmFrame.setLocation(400,150);
                	String str = colorToString(turn);                	
                	String isWinning = isWinning();
                	String confirm;
                	if(isWinning != null && ((isWinning.equals("White") && turn.equals(WHITE)) || (isWinning.equals("Black") && turn.equals(BLACK)))) {
                       str += ", you are winning based on material! Are you sure you wish to resign?";
                	} else {
	                    str += ", are you sure you wish to resign?";
                	}
                    
                    final TextArea text = new TextArea(str);
                    text.setEditable(false);
                    text.setSize(COURT_WIDTH/4, COURT_HEIGHT/4);
                    confirmFrame.add(text, BorderLayout.CENTER);
                    
                    final JPanel yesNo = new JPanel();
                    confirmFrame.add(yesNo, BorderLayout.SOUTH);                   
                    
                    
                    final JButton yesButton = new JButton("Yes");
                    yesButton.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {                            	
                            	confirmFrame.dispose();
                            	resigned = true;
                            	playing = false;
                                repaint();
                            }
                        });
                    yesNo.add(yesButton);
                    
                    final JButton noButton = new JButton("No");
                    noButton.addActionListener(new ActionListener() {
                            public void actionPerformed(ActionEvent e) {     
                            	confirmFrame.dispose();                         	
                            }
                        });
                    yesNo.add(noButton);
                    
                	confirmFrame.pack();
                    //confirmFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
                    confirmFrame.setVisible(true);
                	
                }
            });
        control_panel.add(resign);
        
        final JButton pause = new JButton("Pause");
        pause.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    if(pause.getText().equals("Pause")) {
                    	pause.setText("Play");
                    	playing = false;
                    } else {
                    	pause.setText("Pause");
                    	playing = true;
                    }
                }
            });
        control_panel.add(pause);
        
        final JButton whoIsWinning = new JButton("Who is winning?");
        whoIsWinning.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    whoIsWinning();
                }
            });
        control_panel.add(whoIsWinning);
        
        frame.add(notation_panel, BorderLayout.EAST);
        notation_panel.setEditable(false);
        notation_panel.setFont(Font.getFont(Font.MONOSPACED));
        
        final JPanel clock_panel = new JPanel();
        frame.add(clock_panel, BorderLayout.NORTH);
        clockStatus = new JLabel("Running...  ");
        clock_panel.add(clockStatus);
        frame.add(this, BorderLayout.CENTER);
        frame.setTitle("Vivek A. Raj's Chess Game!");
        /*final JButton reset = new JButton("Reset");
        reset.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    reset();
                }
            });
        control_panel.add(reset);*/
        frame.pack();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
    	allowMouse();
    	whiteClock.setClock(clockTime, 0);
    	blackClock.setClock(clockTime, 0);
        
        // The timer is an object which triggers an action periodically
        // with the given INTERVAL. One registers an ActionListener with
        // this timer, whose actionPerformed() method will be called 
        // each time the timer triggers. We define a helper method
        // called tick() that actually does everything that should
        // be done in a single timestep.
		Timer timer = new Timer(INTERVAL, new ActionListener(){
			public void actionPerformed(ActionEvent e){
				tick();
			}
		});
		timer.start(); 

		// Enable keyboard focus on the court area
		// When this component has the keyboard focus, key
		// events will be handled by its key listener.
		setFocusable(true);
		
		// this key listener allows the square to move as long
		// as an arrow key is pressed, by changing the square's
		// velocity accordingly. (The tick method below actually 
		// pieceMoving the square.)
		
		this.status = status;
	}