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 不保持它的价值?