I'm trying to center a string, but that string changes size depending on a boolean. I want this string to always be centered on my screen. I'm using Graphics to draw.
So I need to do something like this :
String a = boolean ? "Ok" : "Nope";
graphics.drawString(a, width / 2 - a.width, 10);
I'm not sure how exactly to find the width of the string. I assume there is something in graphics.font, but I can't find it :(