Completely copying a JPanel and everything inside it.
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.
Re: Completely copying a JPanel and everything inside it.
Yes, it's possible. JPanel is serializable, so as long as everything you put in it that you want stored is also serializable, you can write it to an ObjectOutputStream for storage, and read it back in later via ObjectInputStream.
The sole justification of teaching, of the school itself, is that the student comes out of it able to do something he could not do before. I say do and not know, because knowledge that doesn't lead to doing something new or doing something better is not knowledge at all...
J. Barzun