在swing中,要把一个JFrame 窗口居中其实很简单,
根本不用去计算屏幕坐标,窗口坐标什么的,一句搞定,如下:
JFrame frame = new JFrame();
frame.setLocationRelativeTo(null);
本文介绍了一种简单的方法来实现Swing中JFrame窗口的居中显示,只需要一行代码即可轻松完成设置。
在swing中,要把一个JFrame 窗口居中其实很简单,
根本不用去计算屏幕坐标,窗口坐标什么的,一句搞定,如下:
JFrame frame = new JFrame();
frame.setLocationRelativeTo(null);