Create a JDialog from JOptionPane in Java
Description
The following code shows how to create a JDialog from JOptionPane.
Example
//from w w w .j a v a 2s .c o m
import javax.swing.JDialog;
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] args) {
JOptionPane pane = new JOptionPane("your message",JOptionPane.ERROR_MESSAGE, JOptionPane.OK_OPTION);
JDialog d = pane.createDialog(null, "title");
d.pack();
d.setModal(false);
d.setVisible(true);
System.exit(0);
}
}
Home »
Java Tutorial »
Swing »
Java Tutorial »
Swing »