private void displayGameOver(Graphics g) {

    g.clearRect(100, 100, 350, 350);
    g.drawString("GAME OVER", 150, 150);

    String textScore = score.getStringScore();
    String textHighScore = score.getStringHighScore();
    String newHighScore = score.newHighScore();

    g.drawString("SCORE = " + textScore, 150, 250);

    g.drawString("HIGH SCORE = " + textHighScore, 150, 300);
    g.drawString(newHighScore, 150, 400);

    g.drawString("press a key to play again", 150, 350);
    g.drawString("Press q to quit the game", 150, 400);
  }
Exemple #2
0
 /** This method will create a frame to show the user his or her Sudoku performance. */
 protected void createScoreFrame() {
   // test = new Score();
   scoreFrame.discard.addActionListener(new DiscardButtonListener());
   scoreFrame.submit.addActionListener(new SubmitHighscoreButtonListener());
   scoreFrame.setLayer(JLayeredPane.PALETTE_LAYER);
   scoreFrame.setVisible(true);
   scoreFrame.setBounds(
       250, // left
       10, // top
       10, // bottom
       10); // right
   scoreFrame.setSize(300, 400);
   scoreFrame.setTitle("Score");
   scoreFrame.pack();
   desktop.add(scoreFrame);
 }