title: Calling A JFrame method from Another JFrame
body: <p>I'm looking to find a solution too my issue. Currently I have 2 <code>JFrames</code> and 1 utilities class in my netbeans project. I'm no expert on java so please bear with me. I've tried looking through the java docs and on this site but cannot seem to find a solution to my problem.</p>
  
  <p>Here is the scenario:</p>
  
  <p>My launcher class launches the <code>JFrame</code> called <strong>MainForm.java</strong> the form then initializes components onto the screen. On this form I have a button that launches a new form called <strong>ConfigEditor.java</strong>. This form is used to edit a config file. I have a <strong>Save</strong> button on this form, and what I basically want to do is once I click save get the <strong>MainForm.java</strong> to call a method to fill in the right components with the new values.</p>
  
  <p>Heres an example, heres some of the code from my Save button on the <strong>ConfigEditor.java</strong>:</p>
  
  <pre><code>if(reply == JOptionPane.YES_OPTION){
          try {
              Utilities.writeConfigFileBasic(ExecutionLists.getText(),DefaultResultsFile.getText(), 
                      DefaultTestDir.getText(), Environments.getText(), ResultsViewerFile.getText());
              ConfigTextArea.append(Utilities.readConfigFile());
              JOptionPane.showMessageDialog(rootPane, "Saved");
  </code></pre>
  
  <p>Now just after the last line I want to call somthing like <code>MainForm.initMyComponents()</code>; as this method exists in the <code>MainForm</code> <code>JFrame</code> but it wont let me call this. The purpose of that method is to populate some of the fields with data extracted from a config file.
  I'm sorry if I haven't explained it very well, I'm fairly new to Java if you need any clarification please let me know and I'll do my best to clarify it.</p>