Forcing JLayerPanes to sit on top of one another

The geek forum. PHP, Perl, HTML, hardware questions etc.. it's all in here. Got a techie question? We'll sort you out. Ask your questions or post a link to your own site here!

Forcing JLayerPanes to sit on top of one another

Postby Dante » Fri Apr 18, 2008 5:41 pm

It would seem like if you were going to create panes whose primary purpose was to simulate three dimensions by allowing one to sit on the other, one would also allow some easy code to tell components to sit on one another in that code... O_o Unfortunately this doesn't seem to be the case in java and its driving me bonkers X_x.

I'm trying to build two different JLayerPanes to hold two different panels... one panel is a nifty background image, the other contains vast numbers of GUI ellements. The problem is that in order to get the Panes to show when you build the frame, you have to set up a layout manager... and by doing this each of the JLayerPanes decide to sit next to one another... defeating the purpose of setting up a 3-D panel to begin with! T_T

Absolute positioning doesn't work, the Java API's definition of the word frame in their main method is the very definition of vague nor do I think this should be so complicated as to require absolute positioning. (The component is difficult to set up as it is). Anyone else run into this problem with JLayerPane?
If so, could you possible pass on what you know? It would be a great help! (I sent an e-mail to my teacher as well, if he gets something to me first I'll post it here).

Thank you,
Pascal
FKA Pascal
User avatar
Dante
 
Posts: 1323
Joined: Thu Mar 04, 2004 8:24 pm
Location: Where-ever it is, it sure is hot!

Postby Dante » Fri Apr 18, 2008 7:39 pm

Hello everyone, just figured it out! YAY!!! Turns out you can used a mixed bag layout to get them on top of one another. Just set the layout to mixedBagLayout and then place both panels in the same container and boom... they will be forced to sit on one another... WHETHER THEY LIKE IT OR NOT! MWAH HA HA HA HA!!!!

Java is so fun...
(Is coding this in TextPad)

-Pascal
FKA Pascal
User avatar
Dante
 
Posts: 1323
Joined: Thu Mar 04, 2004 8:24 pm
Location: Where-ever it is, it sure is hot!


Return to Computing and Links

Who is online

Users browsing this forum: No registered users and 311 guests