Java-第一个Swing

Swing 就是java中的GUI吧

import javax.swing.JFrame;
public class BufferedInputStream extends JFrame{
    public BufferedInputStream(){
        super(); //引用父类的属性方法
        this.setSize(400,300);   //设置大小
        this.getContentPane().setLayout(null);
        this.setTitle("My first swing window"); //设置标题
    }
    public static void main(String[] args){
        BufferedInputStream window = new BufferedInputStream();
        window.setVisible(true);  //设置可见
    }
}

运行效果

在这里插入图片描述

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章