private void setNextState(int correctPosition)
	{
		if (correctPosition == CODE_LENGTH) //all guess pegs were correct
		{
			state = GameState.WON;
			try
			{
				stats.addWin();
			}
			catch (Exception ex)
			{
				JOptionPane.showMessageDialog(this, "Unable to update win count due to file error: " + ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
			}
			
			showWonMessage();
		}
		else if (attempted == ATTEMPTS) //user made last allowed attempt
		{
			try
			{
				stats.addLoss();
			}
			catch (Exception ex)
			{
				JOptionPane.showMessageDialog(this, "Unable to update loss count due to file error: " + ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
			}
			
			showLostMessage();
		}
		else
		{
		   //prepare answer code for testing of the next guess
			for (int i = 0; i < 4; i++)
			{
				code[i].setChecked(false);
			}
			//let user guess again
			attempts[attempted].setEditable(true);
		}
		
	}