wood burning stoves 2.0*
The moose likes Swing / AWT / SWT and the fly likes Problem with a modal dialog Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Problem with a modal dialog" Watch "Problem with a modal dialog" New topic
Author

Problem with a modal dialog

Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
In an application we detect when the user has been inactive for some time, deactivate the application and open a JFrame with a button to open the login dialog. We use a JFrame because we want it to stay on top. The problem is that if the application opens a modal dialog, when the unlock frame comes up it is disabled. The worst happens sometimes when the dialog is not visible and everything looks frozen to the user.
Any help to solve this problem or to do things in a different way will be greatly appreaciated.


Your help will be greatly appreciated,
Alejandro Barrero
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39070
    
  23
Sorry people have taken so long to reply.

Don't know, but one thing which might help would be setting your Dialog window always on top. Look in the API for Dialog.
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
Sorry, I forgot to say that the JFrame is always on top so that the user knows that she has to unlock the application. The problem is that the dialog is modal and it is the only part of the application that accepts events. That is what modal dialogs are supposed to do and perhaps the answer is that I have to use another idea for locking/unlocking the application the application. It appears that locking on user innactivity is a valuable idea; there ought to be a way.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39070
    
  23
Any chance of having an "unlock" button on your Frame, if the Frame is always on top?

Can't help much more; I am afraid I am rather clutching at straws here.

Sorry
Alejandro Barrero
Ranch Hand

Joined: Aug 01, 2005
Posts: 319
Both frames (the application frame and the locking frame) are unable to get focus because of the modal dialog.
I changed the locking frame to a modal dialog and this one works even when the other modal dialog is open. The problem that I have now is that the login window (frame or dialog) that I open from the lock window cannot get the focus.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39070
    
  23
Don't know.

But it appears that having modal dialog which is not on top is counter-productive.
 
GeeCON Prague 2014
 
subject: Problem with a modal dialog