I am a noob to java. i am trying to create a while loop that will prompt the user after each process; as to whether or not they wish to continue. my progress looks like this.
String proString,answer;
char t,f,x;
boolean exitTime;
exitTime = false;
proString = " Would You Like To Continue? \n";
while(!exitTime) {
continue;
}
answer = JOptionPane.showInputDialog(null," Would You Like To Continue? T/F ",HEADING,JOptionPane.INFORMATION_MESSAGE);
x = char.parseChar(answer);
I have tried the following as well to no avail...
Prompt= JOptonPane.showInputDialog(null,proString,HEADING,JOptionPane.QUESTION_MESSAGE);
input = char.parseChar(Prompt);
if(input == "y") {
break;
}
else if(input == "n") {
}
input = char.parseChar(Prompt);
if(input != "y"||"n") {
JOptionPane.showMessageDialog(null,"Invalid Input", "Error", JOptionPane.INFORMATION_MESSAGE);
}
else {
}
I guess my question comes down to should i use JOptionPane.showInputDialog(...) or JOptionPane.showConfirmDialog(...) or another method? please show me how you would do this.