Link to home
Create AccountLog in
Avatar of zizi21
zizi21

asked on

Disable frame

Disable window
i have a jframe , how do i disable that frame when another window comes up.

For example, i click button add, another frame appears.
Avatar of ksivananth
ksivananth
Flag of United States of America image

>>For example, i click button add, another frame appears.

when you click a button, display a JDialog with modal mode and set the frame as the parent for the dialog.
Avatar of sciuriware
sciuriware

You can do a:

frame.setVisible(false);

on the first frame, but I doubt if you are planning the application right.
Why should your main frame disappear for another?

;JOOP!
If you mean to say: I want the new window to catch input and events .....

That happens automatically.

;JOOP!
>>frame.setVisible(false);

this will make the frame hide not disable! Using dialog, you can achieve that!
It all depends on what the questioner really wanted.

;JOOP!
yes, the questionaire asked for disabling the frame in his original question!
if by disabling you mean unable to edit or select  the parent frame,
I think you might want to consider using JDialog and setModal(true).
by doing this way, once the JDialog pop up, you won't be able to select the JFrame until you close the JDialog.
Hope it helps.

Avatar of zizi21

ASKER

hi, i am using jframe for another window as well as it queries a lot of info.

when the second window appears.., the parent window becomes non editable.thanks
Avatar of zizi21

ASKER

okay..i changed to jdialog and put this using JDialog and setModal(true).

and i still able to edit parent window :-(
ASKER CERTIFIED SOLUTION
Avatar of c_maxell
c_maxell
Flag of Singapore image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer