I am writing code for a Reverse Raffle in which once a button is pushed, that panel disappears. I want to put an Image behind the panels to slowly be revealed as the Panels are set to not Visible, but for some reason it isn't showing up, can anyone help? (Please excuse all the commented out code, I've done a lot of troubleshooting with this and I've yet to clean it all up yet.)
I've tried changing the frame.setContentPane to frame.add but that puts the image on top of the panels, and after the panels are clicked, the image goes away.
public static void createAndShowGUI(){
JFrame frame = new JFrame("Raffle");
RaffleBoard myDemo = new RaffleBoard();
JLabel label = null;
frame.setBackground(Color.BLUE);
try {
label = new JLabel(new ImageIcon(ImageIO.read(new File("logo.png"))));
} catch (IOException e) {
e.printStackTrace();
}
frame.add(label);
label.setLocation(0,0);
frame.pack();
try {
frame.setContentPane(myDemo.createContentPane());
}
catch(IOException e) {
e.printStackTrace();
}
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setSize(myDemo.getWidth(),myDemo.getHeight());
frame.setVisible(true);
}