Hello Members,

I have a Class_A which extends a JPanel. This JPanel is inside of a JFrame. In Class_A, I have a series of images (stored in an ImageIcon array) and another image, let's call it Image_A, which is also a ImageIcon type. How do I make Image_A a background image for Class_A and also be able to show the series of images on top of this background?

If the above is not possible, can I make two classes (which extend from JPanel) and layer them on top of another and using the setOpaque(false) method?

I would be grateful for any help.

Thank you!

Well, all you need to do is paint on the panel.
So in the class that extends JPanel create the paintmethod

public void paintComponent(Graphics g) {
 Graphics2D g2d = (Graphics2D) g;

then simply draw onto the panel


this will draw the background image first, then draw everything else above it.

This question has already been answered. Start a new discussion instead.