It is fairly easy to change the position of your JLabel instance by using two methods which are really handing. Look below for the code to use :
HelloWorldFrame()
{
JLabel jlb=new JLabel("HelloWorld");
jlb.setHorizontalAlignment(50); // set the horizontal alignement on the x axis !
jlb.setVerticalAlignment(50); // set the verticalalignement on the y axis !
add(jlb);
this.setSize(100,100);
setVisible(true);
}
You can learn more about JLabel and how to manipulate them here : http://docs.oracle.com/javase/7/docs/api/javax/swing/JLabel.html
//EDITS
Base on the comment that I've given earlier, the alignement that was given could not work. So I made the necessary changes to make them work !
HelloWorldFrame()
{
JLabel jlb=new JLabel("HelloWorld");
jlb.setHorizontalAlignment(SwingConstants.CENTER); // set the horizontal alignement on the x axis !
jlb.setVerticalAlignment(SwingConstants.CENTER); // set the verticalalignement on the y axis !
add(jlb);
this.setSize(100,100);
setVisible(true);
}