Ok, so I understand that if you want to test what the user clicks in a JOptionPane
, you would do something like this:
final int option = JOptionPane.showConfirmDialog(null, "That file name does not exist.", "File Name", JOptionPane.OK_CANCEL_OPTION);
if(option == JOptionPane.CANCEL_OPTION)
{
g++;
}
However, what if I wanted to set a String = to a JOptionPane like this?
String fileName = JOptionPane.showInputDialog("File Name") + ".txt";
How am I supposed to compare what the user clicked then?