Yes, start by taking a look at Measuring Text
String text = "Happy at the bottom";
FontMetrics fm = g.getFontMetrics();
int x = (getWidth() - fm.stringWidth(text)) / 2;
int y = (getHeight() - fm.getHeight()) + fm.getAscent();
g.drawString(text, x, y);
The next question that needs to asked, is could what you want be achieved by using a JLabel
and a BorderLayout
(or other compound layout)....?