
03-13-2008, 06:30 AM
|
 |
Moderator
|
|
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,338
|
|
Thankx pal,
I have a issue in my thread. I have simply write this thread in a separate class.
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.
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...
__________________
Use an appropriate Subject. "Help, urgent!" isn't one. To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Has someone helped you? Then you can To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts. their helpful post.
Want to make your IDE the best? To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
|