public class 设置窗体 extends JFrame {

private JPanel contentPane;

/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
设置窗体 frame = new 设置窗体();
frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}

/**
* Create the frame.
*/
public 设置窗体() {
setTitle("\u63A7\u5236\u7A97\u4F53\u52A0\u8F7D\u65F6\u7684\u4F4D\u7F6E");
addWindowListener(new WindowAdapter() {
@Override
public void windowOpened(WindowEvent e) {
do_this_windowOpened(e);
}
});
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setBounds(100, 100, 450, 300);
contentPane = new JPanel();
contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane);
}

protected void do_this_windowOpened(WindowEvent e) {
setLocationRelativeTo(null);// 设置窗体居中
}
}