创建带有背景图片的JPanel

 
  
1     private Image backgroundImage = new ImageIcon(this.getClass().getResource("/images/beijingtupian.jpg")).getImage();  

2     public JPanel eastScrollPanel = new JPanel(){

3         private static final long serialVersionUID = 1L;    

4 

5         public void paintComponent(Graphics g) {

6              g.drawImage(backgroundImage, 0, 0, this);

7         }

8     };

 

你可能感兴趣的:(JPanel)