JDialog

Hi,I have created a Jdilaog it is a modal dialog. From the model dailog i have created another dialog and i am unable to dispose the another dialog by pressing "X" mark of the dialogthanks in advance
[220 byte] By [zshaneefa] at [2007-11-26 16:50:35]
# 1
Post your code (famous SSCCE)
ProZa at 2007-7-8 23:18:13 > top of Java-index,Desktop,Core GUI APIs...
# 2

MyDialog extends JDialog

MyDialog dialog = new MyDialog();

dialog.setModal(true);

dialog.setVisible(true);

In the MyDialog class i have one instance variable XDialog and one more button

click on button i am creating

XDialog is not a modal dialog

XDilog dilaog = new XDilaog();

dilaog.setDefaultCloseOperation(JDialog.DO_NOTHING_ON_CLOSE);

dilaog .addWindowListener(new WindowAdapter() {

public void windowClosing(WindowEvent e) {

dilaog .dispose();

}

});

zshaneefa at 2007-7-8 23:18:13 > top of Java-index,Desktop,Core GUI APIs...
# 3
your lines are probably in the wrong order
Michael_Dunna at 2007-7-8 23:18:13 > top of Java-index,Desktop,Core GUI APIs...
# 4
or contain the wrong things
itchyscratchya at 2007-7-8 23:18:13 > top of Java-index,Desktop,Core GUI APIs...
# 5

Hi Guys,

i found the solution for this.

If we are creating a dialog from Modal dialog and wants to close the dialog by clicking on "X" created from Model dialog then while creation of the dialog we need to pass the Model dialog instance in the construcor as a owner

like

MyDialog myDialog = new MyDialog(Frame);

XDialog dialog = new XDialog(myDialog);

zshaneefa at 2007-7-8 23:18:13 > top of Java-index,Desktop,Core GUI APIs...