title: dispose JFrame inside a Thread
body: <p>I have a class which extends JFrame and an inner class that extends Thread.
  I want the thread to run until it takes the order to dispose the Frame and open another JFrame from another class.
  I tries this.dispose(); and call the outer.dispose(); but non of them worked.</p>
  
  <p>Here is a sample of the code:</p>
  
  <pre><code>public class outer extends JFrame{
  //some code here
       public class thread extends Thread{
            // some code here
            if(something){
                //I want to dispose this frame here
  }}}
  </code></pre>
  
  <p>Thank you in advance</p>