>>304
int x0 = 20, y0 = 20;
double requestWidth = 100;
String text = "ABC";

Graphics2D g2 = (Graphics2D)g;
FontMetrics fm = g.getFontMetrics();
double m = requestWidth / fm.stringWidth(text);
g2.translate(x0, y0);
g2.scale(m, 1);
g2.translate(-x0, -y0);
g.drawString(text, x0, y0);