一、 JFrame
建立一个MainFrame类,继承JFrame;
编写无参构造函数;
编写main函数,在main函数里添加代码:new MainFrame();
在构造函数里添加下面内容:
this.setTitle("标题"); // 设置标题
this.setSize(800, 600); // 设置尺寸
this.setLocationRelativeTo(null); // 设置默认居中显示
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); // 设置关闭了的动作
this.setVisible(true); // 设置可见