@Override public void setPlayers(PlayerInfo[] value) { // set header label indicating how many players are still needed String labelText = ""; if (value.length == NUMBER_OF_PLAYERS) { labelText = "This game is ready to go!"; addAiButton.setEnabled(false); } else { labelText = ("Waiting for Players: Need " + (NUMBER_OF_PLAYERS - value.length) + " more"); addAiButton.setEnabled(true); } label.setText(labelText); // the center panel contains the individual player panels center.removeAll(); // build an individual player panel and add it to the center panel for (int i = 0; i < value.length; i++) { String builtString = (i + 1) + " " + value[i].getName(); JPanel playerPanel = new JPanel(); playerPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); // left justify the text in the panel playerPanel.setPreferredSize(new Dimension(200, 50)); playerPanel.setBackground( value[i].getColor().getJavaColor()); // set the background color of the player JLabel playerLabel = new JLabel(builtString, SwingConstants.LEFT); // justify the text left FontUtils.setFont(playerLabel, LABEL_TEXT_SIZE); playerPanel.add(playerLabel); center.add(playerPanel); // add space between player panels Dimension minSize = new Dimension(5, 10); Dimension prefSize = new Dimension(5, 10); Dimension maxSize = new Dimension(Short.MAX_VALUE, 10); center.add(new Box.Filler(minSize, prefSize, maxSize)); } }