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
You are always checking for a true condition, hence your message will always show.
You should replace your if (true) statement with if ( n == JOptionPane.YES_OPTION)
When one of the showXxxDialog methods returns an integer, the possible values are:
YES_OPTION NO_OPTION CANCEL_OPTION OK_OPTION CLOSED_OPTION
From here