2018-11-11 15:30:05开始写
1 Toolkit tool = Toolkit.getDefaultToolkit();
2 Dimension d = tool.getScreenSize();
3 setLocation((d.width - getWidth()) / 2, (d.height - getHeight()) / 2);