[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: dialog window which button with time and press

You just need to create a thread which changes the button text every second. 
And which executes the pressbutton functino when the time is finished.

Remeber to use the getShell().getDisplay().asyncExec(runnable) when you 
change the text of the button from the thread.

Something like the following could work (it has not been tested).
new Thread(){
   public void run() {
    for(int time=5; time<0; time--){
     sleep(1000);
     final String text= time+" seconds";
     getShell().getDisplay().asyncExec(new Runnable(){
      public void run() {
       button.setText(text);
      }
     });
    }
    executeOperation();
   }
  }.start();




"Martin Jedlièka" <jedlicka@xxxxxxx> escribió en el mensaje 
news:g0sehl$5fs$1@xxxxxxxxxxxxxxxxxxxx
> How can I create dialog window (or message window/box) which include 
> button with decrement time??
>
> I want to create dialog window with button. This button will show time 
> from 5 second to 0 second. If time will be 0 second this button will press 
> (simulate click button).
>
> How?
>
> Thanks.
>
> Martin
>