Link to home
Start Free TrialLog in
Avatar of searchsanjaysharma
searchsanjaysharma

asked on

How to fix a window i.e Frame

I have a Frame where there are 3 buttons.
When i click on Button 1, Frame1 get opened.
and similarly on other buttons.

How to lock Frame1 so that the user is not able to get into the other frames. As he may shift between windows.
or how to lock the current window or frame.
Avatar of krakatoa
krakatoa
Flag of United Kingdom of Great Britain and Northern Ireland image

You'll probably have to implement an event listener, so when the frame gets the focus, you can neuter it.
Generally speaking, there should only be one Frame/JFrame per application. Additional windows should usually be dialog types. If you make your additional windows extend JDialog instead, set them to modal, and they won't be able to open more than one at a time
http://docs.oracle.com/javase/6/docs/api/java/awt/Dialog.html#setModal(boolean)
ASKER CERTIFIED SOLUTION
Avatar of krakatoa
krakatoa
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of searchsanjaysharma
searchsanjaysharma

ASKER

tx
Ok - not a great solution at all mine, as you know. And as CEHJ said, and I forgot to say, the best way is to use Dialogs for more modal flexibility. If it's not too late, you should consider that.