選択メソッドとしてJOptionPaneを作成しました。文字列配列の選択1、2、または3のint値が必要なので、カウンターとして使用できます。配列のインデックスを取得して、int変数loanChoiceと等しく設定するにはどうすればよいですか?
public class SelectLoanChoices {
int loanChoice = 0;
String[] choices = {"7 years at 5.35%", "15 years at 5.5%",
"30 years at 5.75%"};
String input = (String) javax.swing.JOptionPane.showInputDialog(null, "Select a Loan"
,"Mortgage Options",JOptionPane.QUESTION_MESSAGE, null,
choices,
choices[0]
**loanChoice =**);
}