public PlayerUi(final Player player, List<String> buttonLabels, 
			final PrintWriter printToServer, final BufferedReader inFromServer){
		super();
		
		this.player = player;
		this.printToServer = printToServer;
		this.setX(0);
		this.setY(0);
		
		int sceneR = randomColorVal();
		int sceneG = randomColorVal();
		int sceneB = randomColorVal();
		color = Color.rgb(sceneR, sceneG, sceneB);
		
		Color labelColor = Color.BLACK;
		
		AnchorPane root = new AnchorPane();
		pane = new Pane();
		
		infoLabel = new Text("");
		infoLabel.setLayoutX(20);
		infoLabel.setLayoutY(10);
		pane.getChildren().add(infoLabel);
		
		card1Label = new Text(getCardDisplay(player.getFirstCard(),1));
		pane.getChildren().add(card1Label);
		card1Label.setFill(labelColor);
		card1Label.setLayoutY(20+2 * COMP_VERT_SPACE/3);
		
		card1RevealButton = new Button("Reveal Card 1");
		card1RevealButton.setVisible(false);
		card1RevealButton.setLayoutY(20);
		card1RevealButton.setLayoutX(240);
		card1RevealButton.setOnMouseClicked(new EventHandler<Event>(){
			@Override
			public void handle(Event arg0) {
				player.getFirstCard().reveal();
				printToServer.println(Responses.FirstCard);
				updateFollowingCardReveal();
			}

		});
		pane.getChildren().add(card1RevealButton);
		
		card2Label = new Text(getCardDisplay(player.getSecondCard(),2));
		pane.getChildren().add(card2Label);
		card2Label.setLayoutY(20+4 * COMP_VERT_SPACE/3);
		card2Label.setFill(labelColor);
		
		card2RevealButton = new Button("Reveal Card 2");
		card2RevealButton.setLayoutY(20+COMP_VERT_SPACE);
		card2RevealButton.setLayoutX(240);
		card2RevealButton.setOnMouseClicked(new EventHandler<Event>(){
			@Override
			public void handle(Event arg0) {
				player.getSecondCard().reveal();
				printToServer.println(Responses.SecondCard);
				updateFollowingCardReveal();
			}
		});
		card2RevealButton.setVisible(false);
		pane.getChildren().add(card2RevealButton);
		
		moneyLabel = new Text(getCoinDisplay(player));
		pane.getChildren().add(moneyLabel );
		moneyLabel.setLayoutY(20+COMP_VERT_SPACE * 2);
		moneyLabel.setFill(labelColor);
		int buttonNumber = 1;
		int currentYPos = 0;
		for(final String actionLabel: buttonLabels){
			Button actionButton = new Button();
			actionButton.setText(actionLabel);
			actionButton.setOnMouseClicked(new EventHandler<Event>(){

				@Override
				public void handle(Event arg0) {
					printToServer.println(actionLabel);
					disableAllActions();
				}
			});
			actionButton.setLayoutX(0);
			currentYPos = 20+(buttonNumber + 2) * COMP_VERT_SPACE;
			actionButton.setLayoutY(currentYPos);
			buttonNumber++;
			actionButton.setDisable(true);
			pane.getChildren().add(actionButton);
			allActionButtons.add(actionButton);
		}
		root.getChildren().add(pane);
		
        scene = new Scene(root, 500, 500);
        setTitle(player.toString());
        setResizable(true);
		scene.setFill(color);
        setScene(scene);
        this.show();
        
        winnerText = new Text("YOU WIN!");
		winnerText.setFont(Font.font("Verdana", 20));
		winnerText.setLayoutX(5);
		winnerText.setLayoutY(45);
		winnerText.setFill(Color.WHITE);
		winnerText.setVisible(false); //hide until end of game
		pane.getChildren().add(winnerText );
		
		loserText = new Text("YOU LOSE! :(");
		loserText.setFont(Font.font("Verdana", 20));
		loserText.setLayoutX(5);
		loserText.setLayoutY(45);
		loserText.setFill(Color.WHITE);
		loserText.setVisible(false); //hide until end of game
		pane.getChildren().add(loserText);
		
		gameHistoryPane = new ScrollPane();
		gameHistoryPane.setLayoutX(10);
		gameHistoryPane.setLayoutY(60);
		gameHistoryPane.setMinSize(400,400);
		gameHistoryPane.setVisible(false);
		gameHistoryText = new Text("Game history will go here");
		gameHistoryText.setVisible(false);
		gameHistoryPane.setContent(gameHistoryText);
		pane.getChildren().add(gameHistoryPane);
		
		cannotPlayAgainText = new Text("Other players declined, choose: ");
		cannotPlayAgainText.setLayoutX(5);
		cannotPlayAgainText.setLayoutY(15);
		cannotPlayAgainText.setVisible(false);
		pane.getChildren().add(cannotPlayAgainText);
		
		playAgainButton = new Button("Play again with same players");
		playAgainButton.setLayoutX(5);
		playAgainButton.setVisible(false);
		playAgainButton.setOnMouseClicked(new EventHandler<Event>(){
			@Override
			public void handle(Event arg0) {
				playAgainButton.setDisable(true);
				printToServer.println(Responses.RESTART);
				try {
					String ready = inFromServer.readLine();
					if(ready.equals(Responses.READY.toString())){
						CoupClient.startNewGame(printToServer, inFromServer);
						CoupApplicationClientSide.startNewGame();
					}else if(ready.equals(Responses.NOT_READY.toString())){
						updateToDisplayGameDone();
					}else{
						throw new RuntimeException("Invalid server response: " + ready);
					}
				} catch (IOException e) {
					throw new RuntimeException("No response from server",e);
				}
			}
		});
		pane.getChildren().add(playAgainButton);
		
		quitButton = new Button("Quit");
		quitButton.setVisible(false);
		quitButton.setLayoutX(200);
		quitButton.setOnMouseClicked(new EventHandler<Event>(){
			@Override
			public void handle(Event arg0) {
				printToServer.println(Responses.QUIT);
				System.exit(1);
			}
		});
		pane.getChildren().add(quitButton);
		
		findNewGameButton = new Button("Find a new game");
		findNewGameButton.setVisible(false);
		findNewGameButton.setLayoutX(260);
		findNewGameButton.setOnMouseClicked(new EventHandler<Event>(){
			@Override
			public void handle(Event arg0) {
				printToServer.println(Responses.QUIT);
				CoupClient.establishNewConnection(player.toString());
			}
		});
		pane.getChildren().add(findNewGameButton);
		
		
		cardChooserUI = new CardChooserUI(color, printToServer, pane);
		cardChooserUI.setVisible(false);
		root.getChildren().add(cardChooserUI);
		
		root.getChildren().add(buildBluffCallingPane(currentYPos + 20));
		bluffCallingPane.setVisible(false);
		
		root.getChildren().add(buildBlockingPane(currentYPos + 20));
		blockingPane.setVisible(false);
	}