Duvida entre formulaio e thread

pessoal tenho um formulario que executa uma thread assim que eu aperto o botão porem o formulario trava e não consigo mais matar a thread;

alguem tem alguma dica?

de como fazer isso

olha é o formulario com dois botões começa e para

a thread fica dando printScreen da tela de 5 em 5 segundos se alguem puder me ajudar
olha o codigo do print

[code]import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.io.File;

import javax.imageio.ImageIO;
import javax.swing.JOptionPane;

public class AutoShoot implements Runnable {
private int sleepTime;
int ssCode;

public AutoShoot(int s) {
	sleepTime = 5000;
	ssCode = s;
	

}

public void run() {
	try {
		Thread.sleep(sleepTime);
		System.out.println("Screen Shot ");
		String fileName = "SS" + ssCode + ".gif";
		if (!fileName.toLowerCase().endsWith(".gif")) {
			JOptionPane.showMessageDialog(null,
					"Error: file name must end with x	\".gif\".",
					"Roseindia.net", 1);
		} else {
			Robot robot = new Robot();
			BufferedImage image = robot.createScreenCapture(new Rectangle(
					Toolkit.getDefaultToolkit().getScreenSize()));
			ImageIO.write(image, "gif", new File("c:/SSs/" + fileName));

		}
	} catch (Exception e) {
	}

}

}
[/code]

o código do form é esse

[code]/*

  • To change this template, choose Tools | Templates
  • and open the template in the editor.
    */

/*

  • LBAA.java
  • Created on 15/11/2009, 18:04:56
    */

/**
*

  • @author Rockfido
    */
    public class LBAA extends javax.swing.JFrame {
    int ssCode=0;
    AutoShoot ss;

    /** Creates new form LBAA */
    public LBAA() {
    AutoShoot ss = new AutoShoot(ssCode);
    initComponents();
    }

    /** This method is called from within the constructor to

    • initialize the form.

    • WARNING: Do NOT modify this code. The content of this method is

    • always regenerated by the Form Editor.
      */
      @SuppressWarnings(“unchecked”)
      //
      private void initComponents() {

      jButton1 = new javax.swing.JButton();
      jButton2 = new javax.swing.JButton();

      setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

      jButton1.setText(“Começar”);
      jButton1.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      jButton1ActionPerformed(evt);
      }
      });

      jButton2.setText(“Parar”);
      jButton2.addActionListener(new java.awt.event.ActionListener() {
      public void actionPerformed(java.awt.event.ActionEvent evt) {
      jButton2ActionPerformed(evt);
      }
      });

      javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
      getContentPane().setLayout(layout);
      layout.setHorizontalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(layout.createSequentialGroup()
      .addContainerGap()
      .addComponent(jButton1)
      .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 242, Short.MAX_VALUE)
      .addComponent(jButton2)
      .addContainerGap())
      );
      layout.setVerticalGroup(
      layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
      .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
      .addContainerGap(266, Short.MAX_VALUE)
      .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
      .addComponent(jButton1)
      .addComponent(jButton2))
      .addContainerGap())
      );

      pack();
      }//

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {

     ss.run();
    

    }

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {

    }

    /**

    • @param args the command line arguments
      */

    // Variables declaration - do not modify
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    // End of variables declaration

}
[/code]

alguem tem alguma ideia?