設置窗體左上角顯示的圖標

    //實例化圖標對象
    ImageIcon icon = new ImageIcon("1.jpg");
    //創建Image的對象
    Image image = icon.getImage();
    public FrmJTableDemo() {
        try {
            jbInit();
     //設置窗體顯示的小圖標
            this.setIconImage(image);
            this.setSize(500,450);
            this.setLocation(200,180);
            this.setDefaultCloseOperation(EXIT_ON_CLOSE);
            this.setTitle("信息表");
            this.setVisible(true);

        } catch (Exception exception) {
            exception.printStackTrace();
        }
    }

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