Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with a modal dialog

 
Alejandro Barrero
Ranch Hand
Posts: 335
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Campbell Ritchie
Sheriff
Posts: 48453
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 335
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48453
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 335
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 48453
56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't know.

But it appears that having modal dialog which is not on top is counter-productive.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic