private void setState(ModelStates state) {
		Point windowPoint = currentWindow == null ? new Point(50, 50)
				: currentWindow.getLocation();
		switch (state) {
		case loginsingup:
			currentWindow = loginsingup;
			loginsingup.setLocation(windowPoint);// set window is a custom
													// location
			endgamewindow.setVisible(false);
			gameboard.setVisible(false);
			lobby.setVisible(false);
			newgame.setVisible(false);
			break;
		case lobby:
			currentWindow = lobby;
			lobby.setLocation(windowPoint); // set window in a custom
											// location
			endgamewindow.setVisible(false);
			gameboard.setVisible(false);
			loginsingup.setVisible(false);
			newgame.setVisible(false);
			break;
		case newgame:
			currentWindow = newgame;
			newgame.setLocation(windowPoint); // set window in a custom
												// location
			endgamewindow.setVisible(false);
			gameboard.setVisible(false);
			loginsingup.setVisible(false);
			lobby.setVisible(false);
			break;
		case gameboard:
			currentWindow = gameboard;
			gameboard.setLocation(windowPoint);
			endgamewindow.setVisible(false);
			lobby.setVisible(false);
			loginsingup.setVisible(false);
			newgame.setVisible(false);
			break;
		case endgame:
			currentWindow = endgamewindow;
			endgamewindow.setLocation(windowPoint);
			lobby.setVisible(false);
			gameboard.setVisible(false);
			loginsingup.setVisible(false);
			newgame.setVisible(false);
			break;
		default:
			break;
		}

		// set the state of the machine
		this.state = state;
		currentWindow.setVisible(true);
	}