Hey guys,

I have two JPanels for my game, one jpanel shows my character, informational text and the other shows the map which is made up of a tileset.

Is there anyway I can show the map behind the character and information without merging the two java files?

the Map jpanel uses PaintComponent() and the Character jpanel uses paint()

Thanks PO

Recommended Answers

All 2 Replies

A little update:
So heres what my two panels look like (minus my the scaling difference)
http://img96.imageshack.us/img96/5541/problemzf.png
jpanel1 has the character & info. I want to take jpanel2 (which draws the map) and display it behind jpanel1 so the character can run around on top of the picture.

Originally I tried making it so jpanel1 doesn't draw a background
with setOpaque(false); and then in the frame calling them in order of appearance ie:

jPanel2 p2 = new jPanel2();
add(p2);
jPanel1 p1 = new jPanel1();
add(p1);

but that didn't work.

I'm very lost. I don't have a lot of experience with GUI's.

sidenote:
please keep in mind that jPanel2 is a tileset, so its not as easy as just trying to drop it into the jpanel1 paint() method

Thanks for your help!
PO

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.