Create a yes no cancel dialog with JOptionPane in Java
Description
The following code shows how to create a yes no cancel dialog with JOptionPane.
Example
import java.awt.Component;
/*from www . j a v a2s . co m*/
import javax.swing.JOptionPane;
public class Main {
public static void main(String[] argv) throws Exception {
int result = JOptionPane.showConfirmDialog(null,
"java2s.com","alert", JOptionPane.YES_NO_CANCEL_OPTION);
System.out.println(result);
}
}
The code above generates the following result.
Home »
Java Tutorial »
Swing »
Java Tutorial »
Swing »