title: How to close a called class using JFrame without closing the class that called it?
body: <p>I seem to have a fairly unique problem, and I searched for a while for an answer on here without finding one. I have a class that has a simple JFrame with two buttons. Each button calls the Main method of a different class, as such:</p>
  
  <pre><code>checkRuling = new JButton("Check Your Deck's Rulings");
    checkRuling.addActionListener(new ActionListener() {
       public void actionPerformed (ActionEvent e) {
          ReadHtmlCardDatabase.main(null);
       }
    });
  </code></pre>
  
  <p>One calls a class that takes a series of inputs into a text field and creates a formatted html document from the inputs, and the other loads the html document into a JEditorPane. My problem is that when I close one of the JFrames for the subclasses (either the input or html loader one), it exits my program completely, and I want to keep the main class (with the two buttons) open. I've tried using:</p>
  
  <pre><code>close = new JButton("CLOSE");
       close.addActionListener(new ActionListener() {
          public void actionPerformed (ActionEvent e) {
            System.exit(1);
          }
       });
  </code></pre>
  
  <p>On a button in the subclasses, to no avail. When the button is clicked it simply exits everything. I've also tried using:</p>
  
  <pre><code>JFrame.DISPOSE_ON_EXIT
  </code></pre>
  
  <p>For the subclasses, but this causes the JFrames to go away without the subclasses actually closing, so the first one that saves the html document never actually saves it, and the second subclass that opens that same html document won't work, because it wasn't saved. Any help would be appreciated, because I can't figure out how to do this.</p>