public void process( Color newColor ) {
        
        //get reference color
        Color referenceColor = grid[ 0 ][ 0 ].color;
        //fill adjacent cells
        if( referenceColor != newColor ) {
            fill( 0, 0, referenceColor, newColor );
            turnCount++;
            String stringCount = Integer.toString(turnCount);
            optionPanel.curTurnCount.setText("Turn: "+ stringCount);
	}
        
        //check if grid is filled
        boolean completed = true;
	TEST: for( int row = 0; row < MainPanel.gridSize; row++ ) {
                for( int col = 0; col < MainPanel.gridSize; col++ ) {
                    if( grid[ row ][ col ].color != grid[ 0 ][ 0 ].color ) {
			completed = false;
			break TEST;
                    }
		}
            }
        
        //display message if game was completed
        if( completed ) {
            repaint();
            
            mainPanel.timer.stop();
            int endTime = mainPanel.i-1;
            
            JFrame frame = new JFrame("InputDialog Example #1");

            // prompt the user to enter their name
            String name = JOptionPane.showInputDialog(frame, "What's your name?");

            // get the user's input. note that if they press Cancel, 'name' will be null
            System.out.printf("The user's name is '%s'.\n", name);

            //System.exit(0);
            String scoreCards[] = new String[100];
            
            String scoreCard;
            scoreCard = name+" finished in "+endTime+" seconds and needed "+turnCount+" turns";
            scoreCards[0] = scoreCard;
            String filename = "highscore.xml";

            XML_240 x = new XML_240();
            x.openReaderXML(filename);
            int index = 1;
            String ss = (String) x.ReadObject();
            //System.out.println(ss);
            while(!ss.matches("end")) {
                scoreCards[index] = ss;
                ss = (String) x.ReadObject();
                index++;
            }
            
            x.closeReaderXML();
            
            x.openWriterXML(filename);
            
            for (int i = 0; i < index; i++) {
                x.writeObject(scoreCards[i]);
            }
            x.writeObject("end");
            x.closeWriterXML();
            String message = "Congratulations, " + name + "! You finished in " + endTime + " second and you needed " + turnCount + " turns.\n\n\t";
            for (int j = 1; j < index; j++) {
                message += scoreCards[j];
                message += "\n\t";
            }
            JOptionPane.showMessageDialog( this, message, "Complete", JOptionPane.PLAIN_MESSAGE );
            
            //restart the game
            optionPanel.curTurnCount.setText("Turn: 0");
            optionPanel.timerLabel.setText("Time: 0");
            turnCount = 0;
            //init();
	}
    }