创建带有背景图片的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     };
原文地址:https://www.cnblogs.com/freeabyss/p/3187051.html