I'm using the below code to showing JDialog on taskbar and is perfectly working in JDK 1.6.
public class test8 {
public static void main(String[] args) {
Runnable r = new Runnable() {
public void run() {
JDialog d = new JDialog((Frame)null,Dialog.ModalityType.TOOLKIT_MODAL);
d.setTitle("title");
d.setSize(300,200);
d.setVisible(true);
System.exit(0);
}
};
EventQueue.invokeLater(r);
}
}
But When I'm setting the modality type using the method it's not working
public class test8 {
public static void main(String[] args) {
Runnable r = new Runnable() {
public void run() {
JDialog d = new JDialog();
d.setTitle("title");
d.setSize(300,200);
d.setModalityType(Dialog.ModalityType.TOOLKIT_MODAL);
d.setVisible(true);
System.exit(0);
}
};
EventQueue.invokeLater(r);
}
}
What is the difference betwwen the two codes ? Is there any way to solve this using the method ?