Hi Guys well what I am trying to do is set a background image for my program where my labels, buttons , and text areas sit in front of the background. Everything I try I try I cannot get it to work.


My jframe layout is below so any help you can give would be appreciated:

public background() {
        setLayout(new BorderLayout()); 
        setSize(600, 100); 
        setTitle("background"); 
        
        setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); 
        

        JPanel top = new JPanel(); 
        top.add(new JLabel("Select an option by clicking one of the buttons below"));  
        add("North", top); 

        JPanel bottom = new JPanel(); 
        bottom.add(check);
        check.addActionListener(this); 
        bottom.add(list); 
        list.addActionListener(this); 
        bottom.add(update);
        update.addActionListener(this); 
        query.addActionListener(this); 
        bottom.add(query); 
        bottom.add(quit); 
        quit.addActionListener(this); 
        add("South", bottom);
        setResizable(false); 
        setVisible(true); 
    }

Did you add the image before you added the buttons and labels?

I did add my image before my buttons and labels

This article has been dead for over six months. Start a new discussion instead.