Working on Java Swing recently. The following example shows you how to create confirmation box.
import javax.swing.JFrame;
import javax.swing.JOptionPane;
public class ConfirmPopUps {
public static void main(String[] a) {
JFrame frame = new JFrame();
int result = JOptionPane.showConfirmDialog(frame, "Continue?");
if (JOptionPane.YES_OPTION == result) {
// YES
} else if (JOptionPane.NO_OPTION == result) {
// NO
} else {
// CANCEL
}
}
}
Done =)
Reference: Java2s – JOptionPane Confirm Pop-Ups
