Hello, I am trying to get an animated gif as a background of my JFrame, what I do is:
My frame has a drawPanel where I paint some things, the JPanel has it's own class where I call paintComponent() to draw everything, the constructor of my frame is something like this
The result is the image in front of everything, what I drew on panel is under image and I expect it to be over the image since the gif is a background but it's not behaving like it. Do you know what i am doing wrong? Besides the image is not 400x600, it's a bit smaller so it does not cover full frame, I'd need to scale but that's another thing what really matters is to get it as background and not over my panel.
ok Thank you I am checking it. I was trying to use a a JLayeredPane without success.
and on setImage() I got
but it does not work, the panel does not show. I will test the BackgroundPanel and post anything if works.
edit: The BackgroundPanel does a very nice job however my gif is still on top, each time I press a key the content of the drawPanel shows up but it's like a small flash, what I only see is the gif moving but the other stuff is not on top. This is my modified code which still does not work, any help?