title: How to completely close/delete A JFrame
body: <p>I made a JFrame (call it <code>J1</code>) that includes a JButton. When the button is clicked, a new JFrame (call it <code>J2</code>) opens.
  <code>J1</code> also has an ArrayList that contains <code>J2</code>, and all other Jframes that were opened.
  <code>J2</code> is set to <strong>DISPOSE_ON_CLOSED</strong>
  I set for <code>J2</code> a <strong>windowClosed()</strong> method. For testing, inside the JFrame I looped threw the <code>ArrayList</code>, until I get to the current <code>J2</code> that was just closed, and surprisingly when I do <code>J2.setVisisble(true)</code> the <code>J2</code> window returns! </p>
  
  <p>I also checked threw the Task Manager, and saw the though opening a new <code>J2</code>, will make the overall program consume more RAM, closing each <code>J2</code> doesn't show much difference on the Task Manager, it doesn't look like any memory was freed. It looks like that the memory consumption is going back to "normal" after a few seconds, so i doubt that is has anything to do directly with the <code>J2</code>.</p>
  
  <p>I tried printing (<code>System.out.print</code>) all the <code>ArrayList</code> content every time a new <code>J2</code> is initiated, and after opening a window, closing it, and opening a new one, I get the following messgae:</p>
  
  <pre><code>home.ATMmachine[frame0,252,198,620x420,invalid,hidden,layout=java.awt.BorderLayout,title=ATM Machine No.1,resizable,normal,defaultCloseOperation=DISPOSE_ON_CLOSE,rootPane=javax.swing.JRootPane[,9,38,602x373,invalid,layout=javax.swing.JRootPane$RootLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=16777673,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]
  </code></pre>
  
  <p>This means that the <code>J2</code> wasn't completely deleted!</p>
  
  <p>The JFrame <code>dispose()</code> method is suppose to  </p>
  
  <blockquote>
    <p><em>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.</em> </p>
  </blockquote>
  
  <p>So am I just wrong, and the frame is being deleted sum time later.</p>
  
  <p>If not, then how can i delete the frame in such a way that referencing to it would be like referencing to null?</p>