Hi,
Try scanThread.interrupt();. This will stop the thread from
running, but will not kill the thread.
> -----Original Message-----
> From: Panagiotis Plevrakis [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, May 31, 2002 5:42 AM
> To: JDJList
> Subject: [jdjlist] stopping a Thread
>
> Can anybody show me a good non-deprecated way to stop scanThread in the
> following code? Setting it to null does not make her stop. What more
> should
> I do to make her stop?
> ************************************************************
> btScan.addActionListener(new ActionListener() {
> public void actionPerformed(ActionEvent ae) {
> btScanCounter++;
> btScan.setText("Cancel Search");
> Thread t1 = new Thread() {
> public void run() {
> handleScanButton();
> }};
> if ((btScanCounter%2) == 0) {
> scanThread = null; // THIS DOES NOT WORK
> btScan.setText("Auto Search");
> } else {
> if (scanThread == null) {
> scanThread = new Thread(t1);
> scanThread.start();
> }
> }
> }});
> ************************************************************
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
> To change your membership options, refer to:
> http://www.sys-con.com/java/list.cfm
* ** *** ** * ** *** ** * ** *** ** *
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.
This message has been scanned for viruses.
* ** *** ** * ** *** ** * ** *** ** *
To change your membership options, refer to:
http://www.sys-con.com/java/list.cfm