Hey guys,

I am making a block breaker type game.

One panel houses the background, and one panel has the bricks, paddle, and such. and the other has the background. In my main class when I add the panels in this order:

add(new BrickBoard());
add(panelbg);

the background image shows up over top of the bricks, and when I reverse it to:

add(panelbg);
add(new BrickBoard());

the bricks show up and the background is plain grey as per usual.

How can I fix this?

Thanks Jon

Have you tried adding the brickboard to the panelbg rather than to the window?

Have you tried adding the brickboard to the panelbg rather than to the window?

Hi darkagn, thanks for the reply,

That is a great idea unfortunately it didn't do the trick.

I had another idea, maybe I could make the background on the brickboard slightly translucent...?

Any other ideas?

You can call setOpaque(false) on the brick panel if you'd like it to be transparent.

Hey sorry about the long reply time.

So I figured the best way to get this working properly is to merge it all into one panel, and I just need to get it to render the background first then the blocks, paddle, etc.

Fixed:

Altered the draw settings works great thanks guys!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.