How can I control the Z-order that my overlapping components are drawn in?

John Zukowski

AWT does not define z-order behavior. In fact, it is different on different platforms. You would need to draw all the components yourself, instead of relying on the Container to do this for you.

If you are using Swing, you can place your components inside a JLayeredPane and assign each a layer number. Higher layer numbers appear on top of lower layer numbers. (Note that JDesktopPane is a layered pane; each JInternalFrame can be at different layers.)