title: Dispose a JFrame on button click from another JFrame
body: <p>As many probably know, I am a complete Java newbie. I have already attempted to research this (by reading other posts on StackOverflow, Googling and asking a friend who is less of a java newbie) but I can't figure it out. The answer is probably clear and easy but I am blind to it. I am attempting to dispose a <code>JFrame</code> from a different frame.</p>
  
  <p>My application is supposed to work as follows:  </p>
  
  <ul>
  <li>Frame X has a button, when pressed: spawns frame Y  </li>
  <li>Frame Y has a button, when pressed: spawns frame Z  </li>
  <li>Frame Z has a button, when pressed: performs method from frame Y before disposing frame Y and itself.</li>
  </ul>
  
  <p>Getting frame Z to dispose frame Y is where most of my issues are.
  Any help is greatly appreciated. Ideally help will be phrased in such a way that even a baby could understand (because that is my level of Java comprehension).</p>
  
  <p>I know many will think this is a duplicate question of either <a href="https://stackoverflow.com/questions/7122349/disposing-jframe-from-another-class">this question</a> or <a href="https://stackoverflow.com/questions/21966935/dispose-jframe-from-another-class">this other question</a>. I believe it is not a duplicate question because I have read both and have not understood how to resolve my own problem.</p>