2

I'm trying to use drawString to draw a string that says game over, but it wont work. earlier in the code it works fine but for some reason it stops working.

Code(only the part that doesn't work):

private static void end(Graphics g) {
    g.setColor(BG);
    g.fillRect(0, 0, 900, 900);
    g.setFont(new Font("TimesRoman", Font.PLAIN, 40)); 
    g.drawString("GAME OVER!!", 10, 30);
}
Aree Vanier
  • 195
  • 1
  • 14

1 Answers1

2

You need to set the color to something besides BG for the String to show.

private static void end(Graphics g) {
    g.setColor(BG);
    g.fillRect(0, 0, 900, 900);
    g.setFont(new Font("TimesRoman", Font.PLAIN, 40)); 
    g.setColor(FG)  // Here
    g.drawString("GAME OVER!!", 10, 30);
}
Gilbert Le Blanc
  • 50,182
  • 6
  • 67
  • 111