0
私はここやプログラミング世界全体に新しいので、私を嫌ってはいけません。Java: "if"ステートメントの下で警告ウィンドウが開きません
私のクラスは「if」ステートメントを使用しています。何らかの理由でjavafxの警告ボックスを表示できません。私のコードを短くするためのヒントもあります。
public void start(Stage primarystage) {
TextInputDialog getDemNums = new TextInputDialog();
getDemNums.setTitle("How Many?");
getDemNums.setHeaderText("Input number of people desired: ");
Optional<String> sNumber = getDemNums.showAndWait();
int result = Integer.valueOf(sNumber.get());
if(result>=10){
int bigGroup = result/2;
TextInputDialog tenPlus = new TextInputDialog();
tenPlus.setTitle("Group Assignment");
tenPlus.setContentText("The group size is " + bigGroup + " people.");
} else if (result>=3 && result<10) {
int medGroup = result/3;
Alert medWindow = new Alert(AlertType.INFORMATION);
medWindow.setTitle("Group Assignment");
medWindow.setContentText("The group size is " + medGroup + " people.");
} else if(result<3) {
Alert tooSmall = new Alert(AlertType.INFORMATION);
tooSmall.setTitle("ERROR");
tooSmall.setContentText("The number of people has to be at least three");
( 'medWindow.showAndWaitを試してみてください) '。 – saka1029
デバッガを使用し、コードをステップ実行する必要があります。変数値を表示して、なぜifステートメントにドロップされないのかを確認するのは簡単です。 デバッガの使い方を学ぶことは、プログラマにとって最も貴重なツールの1つです。 – Nevets17