Reputation: 392
I have a main JFrame
which link to another JFrame
in purpose,
lets assume main frame is M
and child frame is C
, when i click on M
a JFrame
C
opens successfully and here i have added setAlwaysOnTop(true)
method to C
JFrame
. Good every thing is working fine.
But when my C
JFrame is on top i don't want my M
JFrame
actions work unless C
JFrame is closed.
This seem to be little awkward and silly question. but please do answer
Upvotes: 1
Views: 170
Reputation: 2742
From your description, it looks to me like you want a modal dialog.
Your C
would basically be a JDialog, and you would set it to Dialog.ModalityType.APPLICATION_MODAL
:
JFrame m = new JFrame(...);
JDialog c = new JDialog(m, "", Dialog.ModalityType.APPLICATION_MODAL );
Read more about modal dialogs here:
Upvotes: 2