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);  //設置可見
    }
}

運行效果

在這裏插入圖片描述

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