I am trying to draw shapes over a background image in a JFrame. I can get the image I want as the background, but I can't get the shapes to be drawn on top of that image. What I've tried so far is just rearranging the order that the components are called, but that doesn't seem to have had an effect. This is where I did it:
JFrame frame = new JFrame ();
frame.setTitle("Happy Holidays!");
frame.setSize(813,645);
frame.setLocationRelativeTo(null);
frame.setDefaultCloseOperation(EXIT_ON_CLOSE);
frame.setVisible(true);
frame.setContentPane(new JLabel(new ImageIcon("C:\\Users\\Brian\\Desktop\\Eclipse Projects\\BrianBolnickFinal\\bin\\christmas.jpeg")));
frame.add(holiday);
Where the content pane contains the image and holiday
is where my shapes are being drawn. Is it something with not being able to draw on a content pane? Or is there something else going wrong in some other place? my holiday
class works fine without the image, so I know that is at least working. Any suggestions?