在另一个线程中,我说过我喜欢通过做这样的事情来集中我的GUI:
JFrame frame = new JFrame("Foo");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.getContentPane().add(new HexagonGrid());
frame.pack();
frame.setLocationRelativeTo(null);
frame.setVisible(true);
Run Code Online (Sandbox Code Playgroud)
但安德鲁汤普森有不同的意见,而是打电话
frame.pack();
frame.setLocationByPlatform(true);
Run Code Online (Sandbox Code Playgroud)
和询问的头脑想知道为什么?