Re: ProgressMonitor Dialog.
Agniputhran,
More information is needed about this ProgressMonitor Dialog you need help on.
What do you want to do?
Do you want to capture window-closing events?
What do you mean when you say 'Cut the Dialog'?
Is the ProgressMonitor not stopping when you try to kill the dialog?
Regards,
dogBear
Re: ProgressMonitor Dialog.
sorry. i got the naming wrong.
I meant the dialog closing event.
When i press the 'close dialog' with the 'X' button (as in windows),
the dialog closes, but it is not asserted as anything.
I want it to report a 'Cancel' operation even if the 'X' is used to close the dialog.
If 'X' is pressed, the dialog is closed, but the background task goes on.
regards.
bhuvan.
Re: ProgressMonitor Dialog.
Agniputhran,
To recap:
The Cancel button works perfectly but the Windows Kill button doesn't.
Without the code you are using, I can only guess at this point.
What I can tell you is that there is a "Window-closing" event that is fired whenever the window is dismissed. Whatever code you wrote that the Cancel button executes when pressed is the same code you want called when the "Window-closing" event is fired.
To quickly help you with this problem, could you supply sample code and I'll show you what you need to do? It's the fastest way.
Regards,
dogBear
Re: ProgressMonitor Dialog.
Hi,
Thats exactly what is happening. The Window close
event is not handled properly.
I need the window close event to work same as
the handler for the 'cancel' button.
I am using the javax.swing.ProgressMonitor class
for doing this.
Here is the code.
...
Timer tim = new Timer ( 500, this );
WorkerThread th = new WorkerThread();
th.start();
ProgressMonitor pm = new ProgressMonitor ( ... );
tim.start();
...
actionPerformed () // called by timer every 500ms
{
//get current state from thread.
// update ProgressMonitor with current state.
if ( pm.isCanceled() )
{
tim.stop(); // stop the timer which does checking.
pm.close(); // close the dialog
th.interrupt(); // stop the thread
}
}
hope this helps.
thanx,
bhuvan.