@Override
    public void actionPerformed(ActionEvent e) {
        Object source = e.getSource();

        if(source == optionPanel.newGameButton) {
            // Needs to resize the frame
            int choice = optionPanel.difficulty.getSelectedIndex();
            int curGridSize = gridSize;
            if (choice == 0) { gridSize = 8; }
            if (choice == 1) { gridSize = 12; }
            if (choice == 2) { gridSize = 16; }
               
            //new game reset properties
            optionPanel.curTurnCount.setText("Turn: 0");
            optionPanel.timerLabel.setText("Time: 0");
            gamePanel.turnCount = 0;
            gamePanel.init();
            
            timer.stop();
            i = 0;
            timer.start();
            
            //repack the frame if gridSize changed
            if (curGridSize != gridSize) {
                frame.pack();
            }
        
	} else if (source == timer) {
            String timeCount = Integer.toString(i++);
            optionPanel.timerLabel.setText("Time: "+timeCount);
        } else {
            for(int i = 0; i < buttonPanel.colorButtons.length; i++) {
		// determine the clicked color and start to process with it
		if(source == buttonPanel.colorButtons[i]) {
                    gamePanel.process( COLORS[i] );
                    break;
		}
            }
	}

	gamePanel.repaint();
    }