Javafx grid center

import javax.swing.JFrame;

import javafx.geometry.HPos;
import javafx.geometry.Pos;
import javafx.geometry.VPos;
import javafx.scene.layout.GridPane;
import javafx.scene.text.Font;
import javafx.scene.text.FontWeight;
import javafx.scene.text.Text;

class GridCenter {
    public static void main(String[] args)
    {	
    	//center grid pane:
    	GridPane pane = new GridPane();
    	pane.setAlignment(Pos.CENTER);
    	
    	//Create element or node
    	Text txt = new Text("Recommendify");
        txt.setFont(Font.font("Dialog", FontWeight.BOLD, 12));
        
    	//center element:
    	GridPane.setHalignment(txt, HPos.CENTER);
    	GridPane.setValignment(txt, VPos.CENTER);
    }
}