Bring JPanel to Front
I'm dragging a JPanel around inside another JPanel with a bunch of other JPanels (confusing). And when I drag them around some go behind each other. I've seen other examples with JLayeredPane but it's not possible in this situation. Does anyone know of another way in which to do this?
Thanks
# 1
In JDK1.5 I believe the concept of Z-order was added which allows you to change the layering in which components are painted.
Prior to that the components are basically painted in the order (or maybe its the reverse order) in which they where added to the container. I've never tried this but you could try removing your dragged panel from the container and then insert it in the order you want it painted using the add(..) method that allows you to specify an insertion position.
# 2
sorry for the slow reply, i was away for the weekend. hm thanks, I'll look into the z-order concept.
yeah the components are definitely being painted in the order I add them (when I drag the first panel added it is infront of all the other ones, while the last panel added, when dragged goes beneath them all)
thanks.