I'm trying to synchronize the dateSpinner with the Day, Month, and Year spinners. however, the information I'm getting from dateInfo is a string with the first three letters of the month, and the setValue function takes an integer. The spinnerMonth is created with an array:
private JSpinner spinnerMonth = new JSpinner
(new SpinnerListModel(Arrays.asList(monthNames).subList(0, 12)));
Anyhow, all I need is to be able to re-call the assigned integer in the array based on the first three letters, if that's even possible? I'm just trying to avoid have a 12-case if-loop.
private void updateOthers()
{
String dateInfo = spinnerDate.getValue().toString();
String tempDay = dateInfo.substring(8,10);
int day1 = Integer.parseInt(tempDay);
String tempMonth = dateInfo.substring(4,7);
int month1 = Integer.parseInt(tempMonth);
String tempYear = dateInfo.substring(24,28);
int year1 = Integer.parseInt(tempYear);
spinnerDay.setValue(day1);
//spinnerMonth.setValue(month1);
spinnerYear.setValue(year1);
}