背景图片不能遮住容器上的控件

解决方案 »

  1.   

    http://community.csdn.net/Expert/topic/4166/4166855.xml?temp=7.099551E-02
      

  2.   

    用到了层的概念。
    bgLable.setIcon(backgroundIcon);
    getContentPane().add(bgLabel,-1);                // 在最底层加一个带背景图的JLabel
    getContentPane().add(yourContentPanel,0);        // 在顶层添加你的组件如果添加的组件是JPanel,要把JPanel设置为透明的。panel.setOpaque(false);