[SOLVED] String in the Middle off player Depending on String Length!

i want to make so player has a name that you type in to a JOptionPane

g.setFont(new Font("serif" , 32, 32));
g.drawString(name, (int)xpos - name.length()*name.length() , (int)ypos - 35);
i get the name to draw but i want it to be in the middle off the text eee... like this

[ ] = player

             Hello All
                [ ]

but it always does something like this
                    Hello All
                [ ]
    Hello All
                [ ]