Does anyone know if its possible to do this?

I have a JPanel called squareContainer, which holds other JPanels called number, all of which have a randomly assigned image to it. Before I start removing/changing the images, I need to completely copy the state of squareContainer and what images are where, then possibly put it back later.

Does anyone know if this is at all possible?

Thank you.