The function drawString(…) does not have anything similar “anchor” that I could put the x and y in the center of the text. I know I can do it manually, and I don’t want to use JTextArea or JLabels as well. Is it possible to do it in a smart way or has no way to do that?
Thanks.
TextLayoutoffers a few conveniences. Here’s an example.