Results 1 to 3 of 3
Thread: Java threading
- 03-12-2008, 04:26 AM #1
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Java threading
Hi all,
Is anyone of you know a tutorial/working example/articles on Threads.
Thanks.
- 03-12-2008, 04:23 PM #2
- 03-13-2008, 05:30 AM #3
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Thankx pal, :)
I have a issue in my thread. I have simply write this thread in a separate class.
Then I call this thread, simply start the thread, in another class which I used to implement a GUI, in a click event as follows.Java Code:public class Processing{ Thread tempTH = new Thread(new Runnable() { public void run(){ int counter = 0; while(counter <= 10){ try { System.out.println(counter++); Thread.sleep(1000); } catch (InterruptedException ex) { System.out.println(ex); } } } }); }
Is that ok. I test it few times that the numbers are printed to console. Actually it works up to now. But why I worried is this.Java Code:private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) { // TODO add your handling code here: Processing appProcess = new Processing(); appProcess.tempTH.start(); }
Even I don't use a thread to implement my GUI, is there a possibility to suspend the GUI actions(I mean possibility to freeze GUI, its controls, etc) when running my second thread.
Because why I think this is, I don't know that Java internally use a thread to run the GUI...
Any comments for me pal...:)
Similar Threads
-
Threading prob..
By banie in forum Java AppletsReplies: 0Last Post: 02-05-2008, 06:30 AM -
Explanation bout threading and concurrency?
By cruxblack in forum New To JavaReplies: 1Last Post: 08-10-2007, 10:33 AM -
question about Multi threading in Java
By fred in forum Advanced JavaReplies: 1Last Post: 07-24-2007, 01:55 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks