Graphics.setFont is slowing down my program

282 views Asked by At

Graphics.setFont seems to cause a big delay in my paint() method:

g.setFont(gameOver); 
g.drawString("GAME OVER!", getWidth()/2, getHeight() / 2);

gameOver is a font class variable(I read that it is more efficient to create a font prior to setting the font instead of creating it on the fly inside my paint method). When I remove g.setFont(gameOver); it runs with no perceptible delay between paint() being called and the string appearing on the screen. Any ideas what's wrong?

0

There are 0 answers