Putting a JPanel inside a JLayeredPane

I'm attempting to put an 'internal' JPanel into a JLayeredPane that is all in another 'main' JPanel.

My internal JPanel will not stay centered on my JLayeredPane.

I have done the setBounds() method on the JLayeredPane, the setSize() and all sorts of other methods, but they don't seem to effect the position of my internal JPanel.

The only thing that effects the positioning of the internal JPanel is changing the Dimensions of the setPreferredSize() method invoked on the JLayeredPane.

Also, if the window is maximazed, the image painted on the internal JPanel will move to the center, but the main JPanel will stay in the top left hand corner.

Does anyone have any ideas what is going on? I'm getting very frustrated!!!

Thanks

[780 byte] By [z0ischa] at [2007-11-26 16:46:23]
# 1

> Does anyone have any ideas what is going on?

Nope.

If you need further help then you need to create a [url http://homepage1.nifty.com/algafield/sscce.html]Short, Self Contained, Compilable and Executable, Example Program[/url] (SSCCE) that demonstrates the incorrect behaviour, because I can't guess exactly what you are doing based on the information provided.

And don't forget to use the [url http://forum.java.sun.com/help.jspa?sec=formatting]Code Formatting Tags[/url] so the code retains its original formatting.

camickra at 2007-7-8 23:13:48 > top of Java-index,Desktop,Core GUI APIs...