title: Operation priority in Java. (An object instantiates and runs before the GUI is updated?)
body: <p>I want the GUI to change the title of a button from "Go" to "Working..." before an object is instantiated and actually does the work.  When finished, I want the title of the button to switch back to "Go."</p>
  
  <p>Here's the code:</p>
  
  <pre><code>    private class convert implements ActionListener {
      public void actionPerformed(ActionEvent e) {
          JButton button = (JButton)e.getSource();
  
          button.setText("Working...");
          button.setEnabled(false);
  
          anObject name = new AnObject();
          boolean result = name.methodName(chooser.getSelectedFile(),encoding);
  
          // A bunch of stuff was here but irrelevant to the question,
          // so it was removed to save room.
  
          button.setEnabled(true);
          button.setText("Go");
      }
  </code></pre>
  
  <p>What actually happens in practise is <em>name</em> is instantiated, <strong>methodName</strong> gets called, and THEN the button gets updated on the screen, despite the fact that I have told the VM to change the button title first.</p>
  
  <p>My working theory is, given I have not made this program threaded, this has something to do with operational priority, or internal threading of the JVM, or something...</p>
  
  <p>Any suggestions?</p>