Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > Java, Cocoa, Threads, and help

Java, Cocoa, Threads, and help
Thread Tools
Wes
Junior Member
Join Date: Apr 2001
Status: Offline
Reply With Quote
Oct 6, 2006, 02:40 AM
 
I'm curious as to how to make a Cocoa(java) application not "freeze" when a long process is running.

In my small example program I have a "go" button that sets in motion a long loop. While this is running I'd like the user to still be able to use the application. Right now its entire interface freezes while this loop is running.

I've tried making a new class (extends Thread) that contains the loop. My "go" button merely sets that thread in motion. But the interface still freezes until the loop is finished.

It would seem that my "go" action isn't returning until the thread is dead. I'm rather new to threads and have been thus far unable to find the answer. Any insight would be greatly appreciated

Code:
public void go(Object sender) { /* IBAction */ threader = new Threader(); threader.run(); }
     
Wes  (op)
Junior Member
Join Date: Apr 2001
Status: Offline
Reply With Quote
Oct 6, 2006, 05:34 AM
 
".start();"
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 08:02 AM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,