Today's Question:  What does your personal desk look like?        GIVE A SHOUT

 ALL


  Modal dialog in Java example code

In Java, we can create modal dialog so that the main JFrame cannot be operated on until the modal dialog is closed. To achieve this, we need to use one class in Java--JDialog. This class can be used to create an modal dialog.Example code :import javax.swing.JDialog;import javax.swing.JLabel;import javax.swing.JPanel;public class Dialog extends JDialog{ public Dialog(){ super(); JPanel panel=new JPanel(); panel.add(new JLabel("Hello dialog")); this.getContentPane().add(panel); } public Dialog(MainFrame mf,String title,boolean modal){ super(mf,title...

40,113 2       JAVA CODE DEMO MODAL JFRAME JDIALOG