Java font: how many pixels are used for the width of a specific character
1 answer
Inside the graphic, you have FontMetrics that can give you an answer using a method stringWidth
like:
FontMetrics metrics = g.getFontMetrics(font);
int width = metrics.stringWidth("3");
+3
source to share