Take advantage of the symmetry of this image.
You can calculate the width of the text using the stringWidth method of the FontMetrics class. You can use this figure to calculate where to place text that should be in the centre.
Notice how the black border is curved inside and out.
You are not asked to do this because it is easy. You are asked to do it because it is hard.