入力を変更するメソッドを使用してダイアログボックスの入力を取得しようとしてcharEdit
いますが、代わりに変数は最後に null のままです。
public String showInputDialog(String stringy)
{
String input = JOptionPane.showInputDialog(this,stringy);
if(input == null || input.isEmpty())
{
input = showInputDialog(stringy);
}
return input;
}
public void charEdit(Checkbox chara,String account,String password){
chara.setLabel(showInputDialog("Character Name?"));
account=(showInputDialog("Account Name?"));
password=(showInputDialog("Account Password?"));
chara.setEnabled(true);
}
public void menuItemSelected(MenuItem menuObj){
if (menuObj==help){
messageBox("Edit character info and then click the login button");
}
else if (menuObj==charOneEdit){
charEdit(characterOne,charAArray[0],charPArray[0]);
}
}
変数 characterOne が値を保持しないのはなぜですか?