package frame;

import java.awt.BorderLayout;

public class JFrameMethod extends JFrame {

	private JPanel contentPane;

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

	/**
	 * Create the frame.
	 */
	public JFrameMethod() {
		//设置窗体在关闭时默认执行的操作
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		//设置窗体显示位置及大小
		setBounds(100, 100, 450, 300);
		//设置标题
		setTitle("标题");
		//设置是否可以调整大小 
		setResizable(false);
		//释放当前窗体
		contentPane = new JPanel();
		//设置边框模式
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		//设置布局模式
		contentPane.setLayout(new BorderLayout(0, 0));
		setContentPane(contentPane);
	}

}

Logo

腾讯云面向开发者汇聚海量精品云计算使用和开发经验,营造开放的云计算技术生态圈。

更多推荐