frameuseinherit.java

来自「java课件」· Java 代码 · 共 36 行

JAVA
36
字号
/*
 * FrameUseInherit.java
 *
 * Created on 2007年11月5日, 上午9:50
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

/**
 *
 * @author Administrator
 */
import javax.swing.JFrame;
public class FrameUseInherit extends JFrame{
    
    /** 无参构造方法 */
    public FrameUseInherit() {
        this("A Frame Demo");
    }
    
    /** 参数为窗口标题的构造方法 */
    public FrameUseInherit(String title){
        super(title);
        this.setSize(400,300);
        this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setVisible(true);
    }
    
    /** main方法 */
    public static void main(String[] args){
        new FrameUseInherit();
        new FrameUseInherit("使用继承创建的窗口");
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?