package com.xyzx.swing;
import javax.swing.JFrame;
/**
* @description 我的记事本主程序
*/
public class NotePad {
public static void main(String[] args) {
initFrame();
}
/**
* @description 初始化Frame(窗体)
*/
public static void initFrame(){
JFrame notePadFrame = new JFrame("我的记事本");
notePadFrame.setSize(300, 400);
notePadFrame.setVisible(true);
}
}
实现的效果:
二、修改:
package com.xyzx.swing;
import javax.swing.JFrame;
/**
* @description 我的记事本主程序
*/
public class NotePad {
/**
* 构造函数
*/
public NotePad(){
JFrame notePadFrame = new JFrame("我的记事本");
// 设置边框
notePadFrame.setBounds(200, 200, 300, 500);
notePadFrame.setVisible(true);
}
public static void main(String[] args) {
new NotePad();
}
}
效果: