{filelink=849}
import java.awt.Dialog;
import java.awt.FlowLayout;
import javax.swing.JDialog;
import javax.swing.JFrame;
public class ModaleExclusionDemo {
public static void main(String[] args) {
final JFrame principale1 = new JFrame("frame Principal");
principale1.setLayout(new FlowLayout());
principale1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
principale1.setBounds(100, 100, 200, 150);
principale1.setVisible(true);
JFrame principale2 = new JFrame("Frame principal2");
principale2.setBounds(500, 100, 300, 150);
principale2.setVisible(true);
JFrame principale3 = new JFrame("Frame principal - Exclu");
principale3.setBounds(300, 400, 300, 150);
principale3.setModalExclusionType(Dialog.ModalExclusionType.APPLICATION_EXCLUDE);
principale3.setVisible(true);
JDialog dialog = new JDialog(principale1, "Boîte de dialogue Modale",
Dialog.ModalityType.APPLICATION_MODAL);
dialog.setBounds(300, 200, 300, 150);
dialog.setVisible(true);
}
}