FontMetrics fm = g.getFontMetrics();
Dimension size=getSize();
int x = (size.width - fm.stringWidth(text))/2;
int y = (size.height - fm.getHeight())/2;
g.setColor (SystemColor.control);
g.fillRect (0, 0, size.width, size.height);
g.setColor (SystemColor.controlShadow);
g.drawLine (0, 0, 0, size.height-1);
g.drawLine (0, 0, size.width-1, 0);
g.setColor (SystemColor.controlDkShadow);
g.drawLine (0, size.height-1, size.width-1, size.height-1);
g.drawLine (size.width-1, 0, size.width-1, size.height-1);
g.setColor (SystemColor.controlText);
g.drawString (text, x, y);