posted 15 years ago
My application is with JInterrnalFrames and JDesktopPane(Virtual desktop).
When I open up a child form, I would like to make parent form disabled.
I tried getting all InternalFrames in virtualdesktop and tried disabling it.I could get all internalframes but I could not disable them.
Any help?
Thanks
Sri
When I open up a child form, I would like to make parent form disabled.
I tried getting all InternalFrames in virtualdesktop and tried disabling it.I could get all internalframes but I could not disable them.
Any help?
Thanks
Sri
posted 15 years ago
Hi,
what do you mean with disabling a JInternalFrame.
Do you mean setEnabled(false)? I think, this can't work, because the components inside the frame are not disabled. You could try to work with the GlassPane. If you set the glasspane of your parent to visible, then no mouseclick would reach a component behind and the glasspane is the most top component. If your childframe is closed, then you have to set the glasspane to invisible.
Hope this helps a bit
Rene
what do you mean with disabling a JInternalFrame.
Do you mean setEnabled(false)? I think, this can't work, because the components inside the frame are not disabled. You could try to work with the GlassPane. If you set the glasspane of your parent to visible, then no mouseclick would reach a component behind and the glasspane is the most top component. If your childframe is closed, then you have to set the glasspane to invisible.
Hope this helps a bit
Rene
Sri Rangan
Ranch Hand
Posts: 160
Rene Liebmann
Ranch Hand
Posts: 196
Sri Rangan
Ranch Hand
Posts: 160
Rene Liebmann
Ranch Hand
Posts: 196
Sri Rangan
Ranch Hand
Posts: 160
posted 15 years ago
Rene
Thanks you very much for the code
I tried opening AlwaysOnTopInternalFrame class from my Partent Internal Frame and as desired I could not edit my Parent Form.
1) But when I clicked on the Parent form, AlwaysOnTopInternalFrame goes behind the Parent form
2) And When I close the AlwaysOnTopInternalFrame, my parent form is still non-editable.
Do I have to do anything different?
Thanks for your time Rene
Sri
Thanks you very much for the code
I tried opening AlwaysOnTopInternalFrame class from my Partent Internal Frame and as desired I could not edit my Parent Form.
1) But when I clicked on the Parent form, AlwaysOnTopInternalFrame goes behind the Parent form
2) And When I close the AlwaysOnTopInternalFrame, my parent form is still non-editable.
Do I have to do anything different?
Thanks for your time Rene
Sri
Rene Liebmann
Ranch Hand
Posts: 196
posted 15 years ago
I found it. My AlwaysOnTop.. worked, but the toFront() method of it was called earlier than the toFront method of the parent frame.
So I added following code to the parent frame:
In other words, I added a InternalFrameListener and in the implementation of it I ask if we have a child frame (which must be a member). If no then we have nothing to do and if yes, we send it to back.
But anyway, I think it will not solve your problem, because the parent frame is editable.
So I think you have to implement a recursive setComponentEnabled method for your internal frames. This you could merge with the AlwaysOnTopInternalFrame.
So I added following code to the parent frame:
In other words, I added a InternalFrameListener and in the implementation of it I ask if we have a child frame (which must be a member). If no then we have nothing to do and if yes, we send it to back.
But anyway, I think it will not solve your problem, because the parent frame is editable.
So I think you have to implement a recursive setComponentEnabled method for your internal frames. This you could merge with the AlwaysOnTopInternalFrame.
Sri Rangan
Ranch Hand
Posts: 160
posted 15 years ago
Rene
It looks like implementing setEnabledComponents() is the only option to disable and enable the Parent and Child Internalfrmaes though it does not seem sleek.
Now I am calling setEnabledComponents() right after my parent form open the child internalframe. But When I close my child form, how can I enable my parent form components.
Passing the parent form reference to the child form when the child form is open so that when the child form is closed I can use the parent for reference to call setEnabledComponents() method.
Thanks
Sri
It looks like implementing setEnabledComponents() is the only option to disable and enable the Parent and Child Internalfrmaes though it does not seem sleek.
Now I am calling setEnabledComponents() right after my parent form open the child internalframe. But When I close my child form, how can I enable my parent form components.
Passing the parent form reference to the child form when the child form is open so that when the child form is closed I can use the parent for reference to call setEnabledComponents() method.
Thanks
Sri
Rene Liebmann
Ranch Hand
Posts: 196
Sri Rangan
Ranch Hand
Posts: 160
posted 15 years ago
Rene
Thanks for your help.
I implemented the internalFrameClosing() on the Parent Frame and calling setComponentEnabled(true). But when my child form is closed, how the internalFrameClosing event on the Parent form will be fired. This event will be fired only when the parent form is closed. Am I missing something?
Sri
Thanks for your help.
I implemented the internalFrameClosing() on the Parent Frame and calling setComponentEnabled(true). But when my child form is closed, how the internalFrameClosing event on the Parent form will be fired. This event will be fired only when the parent form is closed. Am I missing something?
Sri
Rene Liebmann
Ranch Hand
Posts: 196
posted 15 years ago
Maybe my last post sounds a bit confusing. I mean, that your parent form has to implement a InternalFrameListener for the child form. Only then your parent is able to know when your child form is closing.
If this was a homework for you, then I shoud get your mark 1.
[ June 26, 2002: Message edited by: Rene Liebmann ]
If this was a homework for you, then I shoud get your mark 1.

[ June 26, 2002: Message edited by: Rene Liebmann ]
