|
|
|
@ -51,6 +51,11 @@ public class StartScreen extends JPanel {
|
|
|
|
|
*/
|
|
|
|
|
private JLabel error;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The scoreMenu
|
|
|
|
|
*/
|
|
|
|
|
private SectionPanel scoreMenu;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* The constructor needs a view
|
|
|
|
@ -125,16 +130,16 @@ public class StartScreen extends JPanel {
|
|
|
|
|
*/
|
|
|
|
|
private void initializeScoreMenu() {
|
|
|
|
|
// The layout
|
|
|
|
|
SectionPanel scoreMenu = new SectionPanel(Color.WHITE);
|
|
|
|
|
scoreMenu = new SectionPanel(Color.WHITE);
|
|
|
|
|
scoreMenu.shady = false;
|
|
|
|
|
scoreMenu.setLayout(new MigLayout("", "10[center, grow, fill]10",
|
|
|
|
|
"5[center]5"));
|
|
|
|
|
|
|
|
|
|
// adding the compoenents to the layout
|
|
|
|
|
// adding the components to the layout
|
|
|
|
|
JLabel headline = new JLabel("Scores");
|
|
|
|
|
headline.setFont(new Font("Sans-serif", Font.PLAIN, 16));
|
|
|
|
|
headline.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
scoreMenu.add(headline, "cell 0 0, gaptop 5");
|
|
|
|
|
scoreMenu.add(headline, "cell 0 0, gaptop 5, wrap");
|
|
|
|
|
|
|
|
|
|
add(scoreMenu, "cell 1 0, gapleft 5");
|
|
|
|
|
}
|
|
|
|
@ -200,4 +205,28 @@ public class StartScreen extends JPanel {
|
|
|
|
|
error.setText("");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Adds a score to the scoreboard
|
|
|
|
|
* @param score
|
|
|
|
|
*/
|
|
|
|
|
public void addScore(int score) {
|
|
|
|
|
// adding the components to the layout
|
|
|
|
|
|
|
|
|
|
// name
|
|
|
|
|
JLabel lName = new JLabel(getPlayersName());
|
|
|
|
|
lName.setFont(new Font("Sans-serif", Font.PLAIN, 16));
|
|
|
|
|
lName.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
scoreMenu.add(lName, "gaptop 5");
|
|
|
|
|
|
|
|
|
|
// spacing
|
|
|
|
|
JLabel space = new JLabel();
|
|
|
|
|
scoreMenu.add(space);
|
|
|
|
|
|
|
|
|
|
// score
|
|
|
|
|
JLabel lScore = new JLabel(String.valueOf(score));
|
|
|
|
|
lScore.setFont(new Font("Sans-serif", Font.PLAIN, 16));
|
|
|
|
|
lScore.setHorizontalAlignment(SwingConstants.CENTER);
|
|
|
|
|
scoreMenu.add(lScore, "gaptop 5, wrap");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|