Results 1 to 3 of 3

Thread: Java threading

  1. #1
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

  2. #2
    hardwired's Avatar
    hardwired is offline Senior Member
    Join Date
    Jul 2007
    Posts
    1,576
    Rep Power
    9

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,371
    Blog Entries
    1
    Rep Power
    20

    Wink

    Thankx pal, :)

    I have a issue in my thread. I have simply write this thread in a separate class.

    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);
                        }
    		}
                }
    	});
    }
    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:
        private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {                                         
            // TODO add your handling code here:
            Processing appProcess = new Processing();
            appProcess.tempTH.start();
        }
    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.

    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

  1. Threading prob..
    By banie in forum Java Applets
    Replies: 0
    Last Post: 02-05-2008, 07:30 AM
  2. Explanation bout threading and concurrency?
    By cruxblack in forum New To Java
    Replies: 1
    Last Post: 08-10-2007, 11:33 AM
  3. question about Multi threading in Java
    By fred in forum Advanced Java
    Replies: 1
    Last Post: 07-24-2007, 02:55 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •