I have problem with JSpinner over to show Month in JSpinner and i have follow code bellow.I use swing control with jframe form to use spinner control. When I run project it always set default value 0. How to solve this error?
static protected String[] getMonthStrings(){
String[] months=new DateFormatSymbols().getMonths();
int lastIndex=months.length-1;
if(months[lastIndex]==null || months[lastIndex].length()<=0){
String[] mS=new String[lastIndex];
System.arraycopy(months,0,mS, lastIndex,0);
return mS;
}
else{
return months;
}
}
public spinner(boolean CycleMonths) {
initComponents();
JTextField tf=null;
String[] monthStrings = getMonthStrings();
SpinnerListModel monthModel=null;
if(CycleMonths){
monthModel=new CycleSpinnerList(monthStrings);
}
else {
monthModel=new SpinnerListModel(monthStrings);
}
spMonth=new JSpinner(monthModel);
}