相关疑难解决方法(0)

如何最好地定位Swing GUI?

另一个线程中,我说过我喜欢通过做这样的事情来集中我的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)

和询问的头脑想知道为什么?

java user-interface swing

124
推荐指数
2
解决办法
2万
查看次数

标签 统计

java ×1

swing ×1

user-interface ×1