The senario is something like this. User gets a dialog box, and if he selects check box, he will not get this dialog box further.
Now suppose he has already selected the check box (so will not get dialog box), but want to get dialog back, so he can get it back by pressing a particular key.
Now while if user already selected 'not to show dialog' while showing dialog i check whether the key is pressed or not(so dialog can be show again). But this condition is cheked first and then keyPressed event is fired (if pressed key).
Certanly i can't do this condition checking in keyPressed. So i thought of another thread.
I am confused. Is the dialog triggered through the same key?
In any case, my code snippet would still work. In the processKeyEvent you toggle the boolean which indicates if the dialog should be shown or not. In take decision, you check this boolean, and if required, popup the dialog.
PS. On a side note, usually, the show dialog option is through some visual control like some options dialog which is triggered from the menu bar. Better usability that way.
Joined: Sep 20, 2007
Well if check box from the dialog is not set, then there is no any connnection of key and dialog.
The key event comes into the picture only if the check box is already set.
If the check box is already set, then normal procedure is not to show the dialog and procede further.
But if check box is set, and user want to see the dialog, he can see by pressing a particular key.
a) if check box is not already set, dialog will always appear b) if check box is set, dialog will not appear c) if check box is set, and user still want to see dialog, he can get it by pressing a particular key.
So i am checking whether key is set or not as a condition before displaying dialog. But key event is fired after control comes to this key check condition.
So i was looking for new thread.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: How to crate KeyListener in different Thread?