I recently modified my program and I am having trouble figuring out why it does not wait for user input when I call another class that uses JFrame (in this class the user selects his/her choice from a dropdown menu (ComboBox)). It is worth noting that the program was running fine before I converted to GUI, when I was using the scanner.nextLine() function.
When the variable Airline has an undefined value, the program is in a While Loop, and until the user chooses a valid response from the ComboBox the program will exit the While Loop. The problem is that program seems to infinitely loop and will not stop for user input when the UndefinedLine Class is called. Do you guys know how I can fix this? Back when I was using the scanner.nextLine funcion it worked really well. What would be the equivalent of this function after modifying the program to GUI? Please find code below:
while (ExitLoop == false){
switch (Airline) { //Variable Airline
case "AA": // if Airline variable is "AA"
ExitLoop = true;
AA();
break;
case "UA":
ExitLoop = true;
UA();
break;
default:
UndefinedLine UDLobject = new UndefinedLine();
UDLobject.main(args); //Calls class UndefinedLine, which is a JFrame Message with a ComboBox, for which the user chooses the correct Airline and based on the user's response the variable Airline is assigned.
UDLobject.Airline= Airline;//Assigns value for variable Airline from Class UndefinedLine after user has selected the choice
break;
}
}
Thanks, your help will be much appreciated.