A lot of the time, when I want a window to depart from my screen, I just set its visibility to false, setting it back to true when I need it again. But, other times, I want the window to give back any resources it is consuming when it's not visible. If I need it again, I create a new one.
So, I'm re-reading the Window.dispose method's javadoc, where it says this:
Oracle wrote:
public void dispose
Releases all of the native screen resources used by this Window, its subcomponents, and all of its owned children. That is, the resources for these Components will be destroyed, any memory they consume will be returned to the OS, and they will be marked as undisplayable.
The Window and its subcomponents can be made displayable again by rebuilding the native resources with a subsequent call to pack or show. The states of the recreated Window and its subcomponents will be identical to the states of these objects at the point where the Window was disposed (not accounting for additional modifications between those actions).[emphasis added]
I'm confused as to how the states of "recreated" objects can be identical to what they were when the Window was disposed. The previous paragraph of the javadoc has me thinking all those components would have been destroyed, same as any object for which no code was still holding a reference.
How can the state of a recreated object be the same as its destroyed predecssor? Do they mean I can keep the predecessor if I want to, and re-use it? If so, what's that whole paragraph that says Components will be destroyed mean?