怎样用java添加背景图片,同时再在图片的上面添加其他组建,添加后组建显示在图片上。请给出个实例 感激不尽!!!

解决方案 »

  1.   

    给Panel加背景图片,然后把组件放到Panel上
      

  2.   

    Jbuilder 里面没有直接Panel的选项?? 
      

  3.   

    Jbuilder 里面没有直接给Panel加背景图片的选项?? 
      

  4.   

    用swing吧,要用到panel这些东东
      

  5.   


    import javax.swing.ImageIcon;
    import javax.swing.JFrame;
    import javax.swing.JLabel;
    public class BackImageDemo extends JFrame {

    private JLabel label = new JLabel();
    private ImageIcon icon = new ImageIcon("c:/core.jpg"); public BackImageDemo() {
    this.setTitle("BackImageDemo");
    this.setBounds(300, 150, 530, 450);
    this.setDefaultCloseOperation(3);
    this.initial();
    this.setVisible(true);
    }

    private void initial() {
    label.setIcon(icon);
    this.add(label);
    } public static void main(String[] args) {
    new BackImageDemo();
    }}