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.
i have a jframe , how do i disable that frame when another window comes up.
For example, i click button add, another frame appears.
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!
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!
That happens automatically.
;JOOP!
here are some examples using JDialog,
http://java.sun.com/docs/books/tutorial/uiswing/examples/components/index.html#DialogDemo
http://java.sun.com/docs/books/tutorial/uiswing/examples/components/index.html#DialogDemo
>>frame.setVisible(false);
this will make the frame hide not disable! Using dialog, you can achieve that!
this will make the frame hide not disable! Using dialog, you can achieve that!
It all depends on what the questioner really wanted.
;JOOP!
;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.
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.
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
when the second window appears.., the parent window becomes non editable.thanks
ASKER
okay..i changed to jdialog and put this using JDialog and setModal(true).
and i still able to edit parent window :-(
and i still able to edit parent window :-(
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
when you click a button, display a JDialog with modal mode and set the frame as the parent for the dialog.