|
-
Oct 30th, 2007, 06:06 PM
#1
Thread Starter
Hyperactive Member
Threading In Java
How can I thread in java? In vb you can use application.DoEvents and that way your application doesnt freeze when its doing something. How can I do this with Java?
To make things clearer, this is what Im doing. I am simply opening a file and adding each line into a DefaultListModel and then Im setting that model to a JList. While this happens it is freezing the app, since the file is fairly large. If I use threading will this stop the application from freezing? Is there something else I can do?
I appreciate the help.
-
Oct 31st, 2007, 01:25 AM
#2
"I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
My Blog
-
Nov 8th, 2007, 01:01 PM
#3
Member
Re: Threading In Java
Java Code:
class myThread extends Thread {
public void run() //runs when you start the thread
{
while(true)
{
}
}
}
public class myProgram {
public static void main(String[] args) {
Thread newThread = new myThread();
newThread.start(); //starts the thread
}
}
myThread will run seperately from your main myProgram thread.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|