JOptionPane Yes or No window

后端 未结 8 2171
盖世英雄少女心
盖世英雄少女心 2020-12-13 15:55

I am trying to create a message with a Yes or No button. Then a window will appear with a certain message that depends on if the user clicked Yes or No.

Here is m

8条回答
  •  [愿得一人]
    2020-12-13 16:26

    You can fix it with this:

    if(n == JOptionPane.YES_OPTION)
    {
        JOptionPane.showMessageDialog(null, "HELLO");
    }
    else
    {
        JOptionPane.showMessageDialog(null, "GOODBYE");
    }
    

提交回复
热议问题