suspend the awt thread

2003-06-11 Thread Deblauwe, Wim
Title: suspend the awt thread





Hi,


I want to suspend the awt thread but still get painting done. Is this possible?


assume this piece of code:


actionPerformed(ActionEvent e)
{
 Runnable myRunnable = new MyRunnable();
 Thread workerThread = new Thread( myRunnable );
 workerThread.start();


 // Wait here for workerThread to finish
 // but still paint!


 Oject o = myRunnable.getObject();


 // do something with o
}


You are in the actionPerformed, so this gets executed on the awt thread. The workerThread starts with some lengthy operation and we want to wait in the actionPerformed for it to finish and then continue with our work. How do I do it?

kind regards,


Wim


-
Ing. Wim Deblauwe
Software Development Engineer
Medical Imaging Systems - BarcoView
- - - - - - - - DISCLAIMER - - - - - - - - 
Unless indicated otherwise, the information contained in this message is privileged and confidential, and is intended only for the use of the addressee(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message and/or attachments is strictly prohibited. The company accepts no liability for any damage caused by any virus transmitted by this email. Furthermore, the company does not warrant a proper and complete transmission of this information, nor does it accept liability for any delays. If you have received this message in error, please contact the sender and delete the message. Thank you.




Re: suspend the awt thread

2003-06-11 Thread Sachin Hejip
Title: suspend the awt thread



Hey,

From what I understood what you wish to achieve is that the UI 
should continue to repaint but the user should not be able to interact with it 
while you complete your task?
You can - 
a) Show a modal dialog that says "Please Wait" or shows a 
progress bar preferably with a cancel button - this dialog disappears on the 
completion of your task. (I think this is the 
b) Disable all input event dispatching until your operation 
concludes by replacing the EventQueue with your own. 
c) A harder way to achieve this is to have the glass pane take 
focus, block mouse events and disable all menus.

Does this help?

Regards
Sachin

  - Original Message - 
  From: 
  Deblauwe, 
  Wim 
  To: '[EMAIL PROTECTED]' 
  Sent: Wednesday, June 11, 2003 11:40 
  AM
  Subject: suspend the awt thread
  
  Hi, 
  I want to suspend the awt thread but still get painting done. 
  Is this possible? 
  assume this piece of code: 
  actionPerformed(ActionEvent e) {  Runnable myRunnable = new MyRunnable(); 
   Thread 
  workerThread = new Thread( myRunnable ); 
   workerThread.start(); 
   // Wait here for 
  workerThread to finish  
  // but still paint! 
   Oject o = 
  myRunnable.getObject(); 
   // do something 
  with o } 
  You are in the actionPerformed, so this gets executed on the 
  awt thread. The workerThread starts with some lengthy operation and we want to 
  wait in the actionPerformed for it to finish and then continue with our work. 
  How do I do it?
  kind regards, 
  Wim 
  - Ing. Wim Deblauwe 
  Software Development Engineer Medical 
  Imaging Systems - BarcoView - - - - - - - - 
  DISCLAIMER - - - - - - - - Unless indicated 
  otherwise, the information contained in this message is privileged and 
  confidential, and is intended only for the use of the addressee(s) named above 
  and others who have been specifically authorized to receive it. If you are not 
  the intended recipient, you are hereby notified that any dissemination, 
  distribution or copying of this message and/or attachments is strictly 
  prohibited. The company accepts no liability for any damage caused by any 
  virus transmitted by this email. Furthermore, the company does not warrant a 
  proper and complete transmission of this information, nor does it accept 
  liability for any delays. If you have received this message in error, please 
  contact the sender and delete the message. Thank 
you.


Re: suspend the awt thread

2003-06-11 Thread Sachin Hejip
Title: suspend the awt thread



Sorry - sent it before completing my sentence - I meant to say 
a) seems the best way . :-)

  - Original Message - 
  From: 
  Sachin 
  Hejip 
  To: Deblauwe, Wim ; [EMAIL PROTECTED] 
  Sent: Wednesday, June 11, 2003 12:14 
  PM
  Subject: Re: suspend the awt thread
  
  Hey,
  
  From what I understood what you wish to achieve is that the 
  UI should continue to repaint but the user should not be able to interact with 
  it while you complete your task?
  You can - 
  a) Show a modal dialog that says "Please Wait" or shows a 
  progress bar preferably with a cancel button - this dialog disappears on the 
  completion of your task. (I think this is the 
  b) Disable all input event dispatching until your operation 
  concludes by replacing the EventQueue with your own. 
  c) A harder way to achieve this is to have the glass pane 
  take focus, block mouse events and disable all menus.
  
  Does this help?
  
  Regards
  Sachin
  
- Original Message - 
From: 
Deblauwe, Wim 
To: '[EMAIL PROTECTED]' 
Sent: Wednesday, June 11, 2003 11:40 
AM
Subject: suspend the awt thread

Hi, 
I want to suspend the awt thread but still get painting 
done. Is this possible? 
assume this piece of code: 
actionPerformed(ActionEvent e) {  Runnable myRunnable = new MyRunnable(); 
 Thread 
workerThread = new Thread( myRunnable ); 
 workerThread.start(); 
 // Wait here for 
workerThread to finish  
// but still paint! 
 Oject o = 
myRunnable.getObject(); 
 // do something 
with o } 
You are in the actionPerformed, so this gets executed on the 
awt thread. The workerThread starts with some lengthy operation and we want 
to wait in the actionPerformed for it to finish and then continue with our 
work. How do I do it?
kind regards, 
Wim 
- Ing. Wim 
Deblauwe Software Development Engineer 
Medical Imaging Systems - BarcoView - - - - - - - - DISCLAIMER - - - - - - - - Unless indicated otherwise, the information contained in this message 
is privileged and confidential, and is intended only for the use of the 
addressee(s) named above and others who have been specifically authorized to 
receive it. If you are not the intended recipient, you are hereby notified 
that any dissemination, distribution or copying of this message and/or 
attachments is strictly prohibited. The company accepts no liability for any 
damage caused by any virus transmitted by this email. Furthermore, the 
company does not warrant a proper and complete transmission of this 
information, nor does it accept liability for any delays. If you have 
received this message in error, please contact the sender and delete the 
message. Thank you.


RE: suspend the awt thread

2003-06-11 Thread Deblauwe, Wim
Title: suspend the awt thread



Yes, 
a) is what I want to do. Now the progressbar is started in the MyRunnable() 
class. Are you saying that I should start it within the actionPerformed() 
method?

  -Original Message-From: Sachin Hejip 
  [mailto:[EMAIL PROTECTED]Sent: woensdag 11 juni 2003 
  8:45To: Deblauwe, Wim; [EMAIL PROTECTED]Subject: Re: 
  suspend the awt thread
  Sorry - sent it before completing my sentence - I meant to 
  say a) seems the best way . :-)
  
- Original Message - 
From: 
Sachin 
Hejip 
To: Deblauwe, Wim ; [EMAIL PROTECTED] 
Sent: Wednesday, June 11, 2003 12:14 
PM
Subject: Re: suspend the awt 
thread

Hey,

From what I understood what you wish to achieve is that 
the UI should continue to repaint but the user should not be able to 
interact with it while you complete your task?
You can - 
a) Show a modal dialog that says "Please Wait" or shows a 
progress bar preferably with a cancel button - this dialog disappears on the 
completion of your task. (I think this is the 
b) Disable all input event dispatching until your 
operation concludes by replacing the EventQueue with your own. 
c) A harder way to achieve this is to have the glass pane 
take focus, block mouse events and disable all menus.

Does this help?

Regards
Sachin

  - Original Message - 
  From: 
  Deblauwe, Wim 
  To: '[EMAIL PROTECTED]' 
  Sent: Wednesday, June 11, 2003 11:40 
  AM
  Subject: suspend the awt thread
  
  Hi, 
  I want to suspend the awt thread but still get painting 
  done. Is this possible? 
  assume this piece of code: 
  actionPerformed(ActionEvent e) {  Runnable myRunnable = new MyRunnable(); 
   Thread 
  workerThread = new Thread( myRunnable ); 
   workerThread.start(); 
   // Wait here 
  for workerThread to finish 
   // but still 
  paint! 
   Oject o = 
  myRunnable.getObject(); 
   // do something 
  with o } 
  You are in the actionPerformed, so this gets executed on 
  the awt thread. The workerThread starts with some lengthy operation and we 
  want to wait in the actionPerformed for it to finish and then continue 
  with our work. How do I do it?
  kind regards, 
  Wim 
  - Ing. Wim 
  Deblauwe Software Development Engineer 
  Medical Imaging Systems - BarcoView - - - - - - - - DISCLAIMER - - - - - - - - Unless indicated otherwise, the information contained in this 
  message is privileged and confidential, and is intended only for the use 
  of the addressee(s) named above and others who have been specifically 
  authorized to receive it. If you are not the intended recipient, you are 
  hereby notified that any dissemination, distribution or copying of this 
  message and/or attachments is strictly prohibited. The company accepts no 
  liability for any damage caused by any virus transmitted by this email. 
  Furthermore, the company does not warrant a proper and complete 
  transmission of this information, nor does it accept liability for any 
  delays. If you have received this message in error, please contact the 
  sender and delete the message. Thank 
  you.

- - - - - - - - DISCLAIMER - - - - - - - - 

Unless indicated otherwise, the information contained in this message is privileged and confidential, and is intended only for the use of the addressee(s) named above and others who have been specifically authorized to receive it. If you are not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this message and/or attachments is strictly prohibited. The company accepts no liability for any damage caused by any virus transmitted by this email. Furthermore, the company does not warrant a proper and complete transmission of this information, nor does it accept liability for any delays. If you have received this message in error, please contact the sender and delete the message. Thank you.