I'm trying to draw text in the middle of my JFrame window, and it's off by a little bit.
Here's what I've tried :
FontMetrics fontMetrics = g.getFontMetrics(font);
// draw title
g.setColor(Color.WHITE);
g.setFont(font);
int titleLen = fontMetrics.stringWidth("Level 1 Over!");
g.drawString("Level 1 Over!", (screenWidth / 2) - (titleLen / 2), 80);