I have a sub-dialog in my application that calculates some parameters, which the user can decide to accept or ignore. The calculation of the parameters takes about 10 seconds, so I tried to put up a wait cursor and disable keyboard and mouse input until it finishes. The wait cursor comes up fine, but I can click on buttons or type in text fields while the wait cursor is up and the actions occur once the calculation finishes.
Here is a simplified version of what I tried-
I thought if the glass pane was visible and I had mouse and key listeners that ignored input, then the user would not be able to interact with the dialog. But that is not quite the case. You can hit the done button while the calculation is running and the dialog dismisses as soon as the calculation is finishes. Or you can click in the text field and then type text and it shows up once the calculation finishes.
Could someone set me straight on how one is supposed to handle this situation?
From what I read, it seemed like the 'standard' approach when you don't want a dialog to have user interaction is to put a glass plane over it. Maybe I should try that in a regular dialog and see if I can get that working first. The advantage over disabling individual components is that I don't have to loop over every component in the dialog or change my wait routine if I change a dialog element. Needless to say, the real dialog is more complex than the example.
The same commands just using a JFrame also successfully bring up a wait cursor, but do not stop mouse or keyboard events. So clearly I need to have that working first.