I am having some problems with setting an image as a background. The image will only show when I move the entire window. Below is a fragment of my code including setting a background image.
playButton = new JButton(pbI);
instructionButton = new JButton(ibI);
quitButton = new JButton(qbI);
mainFrame = new JFrame("My Major Project");
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
mainFrame.setSize(800, 600);
mainFrame.setLocationRelativeTo(null);
mainFrame.setLayout(null);
mainFrame.setLayout(new BorderLayout());
mainFrame.setContentPane(new JLabel(new ImageIcon("background.gif")));
mainFrame.setLayout(new FlowLayout());
mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);