This is the code, which helps to display confirm dialog box on screen, First if statement just checks which radio button are pressed, than a confirm dialog box appears, On which there is option available , which is "ok" and "cancel". So when I click either "ok" or "Cancel" another confirm dialog box appears, which must have to show message, which shows which one is clicked, but there is an error, even if I click "ok" , it shows you pressed cancel
if (Choose == okCancel.getText() && IconChoose == NoneRadioButton.getText())
{
int response =
JOptionPane.showConfirmDialog(null, txt, " Message Dialog Box",
JOptionPane.OK_CANCEL_OPTION);
}
else if (response == JOptionPane.OK_OPTION)
{
JOptionPane.showConfirmDialog(null, "You Pressed OK ","",
JOptionPane.DEFAULT_OPTION);
}
if (response == JOptionPane.CANCEL_OPTION)
{
JOptionPane.showConfirmDialog(null, "You Pressed CANCEL ","",
JOptionPane.DEFAULT_OPTION);
}