title: How can I pass arguments into SwingWorker?
body: <p>I'm trying to implement Swing worker in my GUI. At the moment I have a JFrame containing a button. When this is pressed it should update a tab displayed and then run a program in the background thread. Here is what I have so far.</p>
  
  <pre><code>class ClassA
  {
      private static void addRunButton() 
      {
          JButton runButton = new JButton("Run");
          runButton.setEnabled(false);
          runButton.addActionListener(new ActionListener() {
              public void actionPerformed(ActionEvent e) 
              {
                  new ClassB().execute();
              }
      });
  
      mainWindow.add(runButton);
      }
  }
  
  class ClassB extends SwingWorker&lt;Void, Integer&gt;
  {
      protected Void doInBackground()
      {
          ClassC.runProgram(cfgFile);
      }
  
      protected void done()
      {
          try 
          { 
          tabs.setSelectedIndex(1);
          } 
          catch (Exception ignore) 
          {
          }
      }
  }
  </code></pre>
  
  <p>I don't understand how I can pass in my <code>cfgFile</code> object though. Please can someone advise on this?</p>