Reputation: 193
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);
}
Upvotes: 2
Views: 6127
Reputation: 51565
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);
}
Upvotes: 2