You just have to put the pack(); before!
-
Basta colocar o pack(); antes!
//...
this.pack();
//pack() before!
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension screenSize = tk.getScreenSize();
setLocation((screenSize.width - this.getWidth()) / 2, (screenSize.height - this.getHeight()) / 2);
//...
Nenhum comentário:
Postar um comentário