設置JPanel或jframe的背景圖片

public void setBak() {

        ((JPanel) this.getContentPane()).setOpaque(false);

        ImageIcon img = new ImageIcon("f://9.jpg");

        JLabel background = new JLabel(img);

      this.getLayeredPane().add(background,newInteger(Integer.MIN_VALUE));

background.setBounds(0,0,img.getIconWidth(),img.getIconHeight());

}

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